HTTP server mocking and expectations library for Node.js. Nock can be used to test modules that perform HTTP requests in isolation. For instance, if a module performs HTTP requests to a CouchDB server or makes HTTP requests to the Amazon API, you can test that module in isolation. Nock works by overriding Node's http.request function. Also, it overrides http.ClientRequest too to cover for modules that use it directly.

Features

  • The latest version of nock supports all currently maintained Node versions
  • When you setup an interceptor for a URL and that interceptor is used, it is removed from the interceptor list
  • The request path can be a string, a RegExp or a filter function and you can use any HTTP verb.
  • You can specify the request body to be matched as the second argument to the get, post, put or delete specifications
  • Nock supports array-style/object-style query parameters
  • Access original request and headers

Project Samples

Project Activity

See All Activity >

License

MIT License

Follow Nock

Nock Web Site

Other Useful Business Software
Paessler: Easy to Use With Enterprise Power. Free Trial Icon
Paessler: Easy to Use With Enterprise Power. Free Trial

A low-code dashboard makes monitoring intuitive for any admin, while scripting and custom sensors give experts full control.

You shouldn't have to choose between a monitoring tool that's easy to use and one that's powerful enough for a complex environment. PRTG's low-code interface lets any admin build dashboards, set alerts and monitor devices without scripting, while custom sensors and full API access are there when your team needs deeper control. One platform, no compromise. Download a free 30-day trial now.
Get Free Download
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of Nock!

Additional Project Details

Programming Language

JavaScript

Related Categories

JavaScript HTTP Servers, JavaScript Libraries

Registered

2023-05-08