NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
npm · #3651 most downloaded on npm
HTTP server mocking and expectations library for Node.js
Last release 13 days ago
21 Sep 2026
Ships fairly regularly
a new release about every 5 weeks
Nearly every release is documented
notes for 60 of the last 60 stable releases
2 versions withdrawn
withdrawn after publishing
15 years old
470 releases · first in 2011
add context.query() to nock back
typescript: filteringBodyRequest
One column per quarter.
Revert "chore(deps-dev): bump @definitelytyped/dtslint from 0.0.163 to 0.0.183" (#2544) (d978acd), closes #2544 #2534
## 13.3.6 (2023-10-19) ### Bug Fixes * remove semver usage
## 13.3.5 (2023-10-19) ### Bug Fixes * deps: remove lodash
typescript: support nock(new URL('https://example.test/'))
nock.removeInterceptor can remove the wrong Intercept
update Socket for Node 18 compat
# 13.3.0 (2023-01-10) ### Features * support for WHATWG URLs
README: Add notes about Scope vs Interceptor matchHeader calls
types: allow regexp on Definition#scope and Definition#path
InterceptedRequestRouter.handleWrite arity issue
Revert "chore(deps-dev): bump got from 11.8.3 to 12.1.0" (#2366) (f46b808), closes #2366
dep: migrate from lodash.set to lodash.
looking up timeout on agent with no options
delay when timeout is on the Agent (#2297) (616d903), closes #2296
allowUnocked not working with regex host + request body match
type: add update type for record mode (#2250) (e8f23b1), closes #2241
# 13.2.0 (2021-11-08) ### Features * record: update mode
## 13.1.4 (2021-10-19) ### Bug Fixes * send Buffer with length
interceptor: don't hang, don't leak resources
types: add missing argument to optionally()
types: allow readonly arrays for data matcher in types
# 13.1.0 (2021-05-31) ### Features * node 16 compatibility
interceptor: don't require leading slash if Scope has a base pathname
recorder: don't automatically resume the response
playback: consistently check for destroyed attribute
socket: add encrypted attribute for secure requests (#2149) (8de6b69), closes /github.com/nodejs/node/blob/295e766c2782d6d83e33004f7c2204c0a8d52655/li
recorder: escape single quotes in path of default output
intercept: handle global flags during regexp matching (#2135) (dc04694), closes #2134
overrider: allow calling empty req.end multiple times (20e9f8a), closes /github.com/nodejs/node/blob/39a7f7663e8f70fc774105d8fa41b8e4cc69149f/lib/_htt
req.end multiple times (20e9f8a), closes /github.com/nodejs/node/blob/39a7f7663e8f70fc774105d8fa41b8e4cc69149f/lib/_http_outgoing.js#L816Parallel requests on same Interceptor are exposed correctly in reply functions
data comparison with undefined object values
intercept: mark Interceptors consumed immediately
allow Content-Type request introspection when header is an array (#2010) (e432ac5), closes #2009
Scope.log has been removed. Use the debug library when debugging failed matches.
See the Migration Guide
Scope.log has been removed. Use the debug library when debugging failed matches.
socketDelay has been removed. Use delayConnection instead.
delay, delayConnection, and delayBody are now setters instead of additive.
When recording, skipping body matching using * is no longer supported by nock.define.
Set the definition body to undefined instead.
ClientRequest.abort() has been updated to align with Node's native behavior.
This could be considered a feature, however, it created some subtle differences that are not backwards compatible. Refer to the migration guide for details.
Playback of a mocked responses will now never happen until the 'socket' event is emitted.
ClientRequest: Use native abort and destroy
remove socketDelay (#1974) (6a5a3cf), closes #1973
socketDelay has been removed. Use delayConnection instead.delay, delayConnection, and delayBody are now setters instead of additive.
example:nock('http://example.com')
.get('/')
.delay(1)
.delay({ head: 2, body: 3 })
.delayConnection(4)
.delayBody(5)
.delayBody(6)
.reply()
Previously, the connection would have been delayed by 7 and the body delayed by 14. Now, the connection will be delayed by 4 and the body delayed by 6.
remove Scope.log in favor of more debug
Scope.log has been removed. Use the debug library when debugging failed matches.router: bring behavior of abort() inline with native Node (#1960) (5c1b937), closes #439
Calling request.abort():
abort is called between the 'socket' and 'response' events.nextTick.nextTick that propagates though the request object.request.aborted attribute is set to true instead of a timestamp. Changed in Node v11.0 https://github.com/nodejs/node/pull/20230write, end, or flushHeaders on an aborted request no longer emits an error.
However, writing to a request that is already finished (ended) will emit a 'write after end' error.Playback of a mocked responses will now never happen until the 'socket' event is emitted.
The 'socket' event is still artificially set to emit on nextTick when a ClientRequest is created.
This means in the following code the Scope will never be done because at least one tick needs
to happen before any matched Interceptor is considered consumed.
const scope = nock(...).get('/').reply()
const req = http.get(...)
scope.done()
Skipping body matching using "*" is no longer supported. Set the definition body to undefined instead. This was deprecated in v11.
body to undefined instead.
This was deprecated in v11.router: stall finish event to avoid dup (#1954) (d81c260), closes #1832
types: remove inaccurate Scope.restore method
Replace a few more uses of lodash (#1916) (1f47f1a), closes #1285
Require Node 10+ (#1895) (123832e), closes #1895
nock global from cleanAll() (#1872) (0a4a944), closes #1872When checking types of strings, Nock will no longer recognize the String constructor, only string primitives.
Fix version number for breaking changes
revert breaking changes from v11.9.0
allow passing a function to enableNetConnect()
allow passing a function to enableNetConnect()
allowMocked when using a callback for the path (#1877) (9fdeeca), closes #1867
## 11.8.1 (2020-02-10) ### Bug Fixes * only activate once, when on
types: Scope accepts legacy Url not WHATWG
Fix a regression due to Jest having different globals
make interceptors work in any order even when filteringScope (#1819) (bd39dff), closes #1818
types: add type for Nock Back currentMode (#1794) (ba60fd2), closes /github.com/nock/nock/blob/master/lib/back.js#L282
currentMode (#1794) (ba60fd2), closes /github.com/nock/nock/blob/master/lib/back.js#L282Add lifecycle function to clear pending timeouts (#1748) (187db85), closes #1118
Throw errors for URL paths without leading slashes, which will never match (#1744) (b7f9f13), closes #1730
improve error output by showing which URL caused the error
## 11.3.6 (2019-10-05) ### Bug Fixes * Fix error message
Your coding agent can read these notes before it upgrades. Set up the MCP server →