nock 13.2.8 → 13.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +13 -0
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -846,11 +846,24 @@ If you need to match requests only if certain request headers match, you can.
846
846
 
847
847
  ```js
848
848
  const scope = nock('http://api.myservice.com')
849
+ // Interceptors created after here will only match when the header `accept` equals `application/json`.
849
850
  .matchHeader('accept', 'application/json')
850
851
  .get('/')
851
852
  .reply(200, {
852
853
  data: 'hello world',
853
854
  })
855
+ .get('/')
856
+ // Only this interceptor will match the header value `x-my-action` with `MyFirstAction`
857
+ .matchHeader('x-my-action', 'MyFirstAction')
858
+ .reply(200, {
859
+ data: 'FirstActionResponse',
860
+ })
861
+ .get('/')
862
+ // Only this interceptor will match the header value `x-my-action` with `MySecondAction`
863
+ .matchHeader('x-my-action', 'MySecondAction')
864
+ .reply(200, {
865
+ data: 'SecondActionResponse',
866
+ })
854
867
  ```
855
868
 
856
869
  You can also use a regexp for the header body.
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "testing",
8
8
  "isolation"
9
9
  ],
10
- "version": "13.2.8",
10
+ "version": "13.2.9",
11
11
  "author": "Pedro Teixeira <pedro.teixeira@gmail.com>",
12
12
  "repository": {
13
13
  "type": "git",
@@ -45,11 +45,11 @@
45
45
  "mocha": "^9.1.3",
46
46
  "npm-run-all": "^4.1.5",
47
47
  "nyc": "^15.0.0",
48
- "prettier": "2.6.2",
48
+ "prettier": "2.7.1",
49
49
  "proxyquire": "^2.1.0",
50
50
  "rimraf": "^3.0.0",
51
51
  "semantic-release": "^19.0.2",
52
- "sinon": "^13.0.1",
52
+ "sinon": "^14.0.0",
53
53
  "sinon-chai": "^3.7.0",
54
54
  "typescript": "^4.2.2"
55
55
  },