What is the expected behavior?
I'd expect to be able to provide objects with any JSON-parseable value as request matcher, like so:
nock('https://example.com')
.post('/path', { number: 1 })
.reply(200);
What is the actual behavior?
Type definitions allow only strings to be passed as values.
Possible solution
Extend type definitions to include all supported types.
How to reproduce the issue
See the example code above. It will result in the TypeScript compiler error: Argument of type '{ number: number; }' is not assignable to parameter of type 'string | RegExp | Buffer | DataMatcher | ((body: any) => boolean) | undefined'.
Does the bug have a test case?
I guess it's not currently in the codebase.
Versions
| Software |
Version(s) |
| Nock |
v11.3.2 |
| Node |
v10.16.3 |
What is the expected behavior?
I'd expect to be able to provide objects with any JSON-parseable value as request matcher, like so:
What is the actual behavior?
Type definitions allow only strings to be passed as values.
Possible solution
Extend type definitions to include all supported types.
How to reproduce the issue
See the example code above. It will result in the TypeScript compiler error:
Argument of type '{ number: number; }' is not assignable to parameter of type 'string | RegExp | Buffer | DataMatcher | ((body: any) => boolean) | undefined'.Does the bug have a test case?
I guess it's not currently in the codebase.
Versions