You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, unsure if rest of references to it (found 3 more) behave the same.
How to reproduce the issue
In a project with Typescript, use matchHeader to intercept a request, and use a function as RequestHeaderMatcher. You'll receive a string[] instead of a string as types say.
Having problem producing a test case? Try and ask the community for help. If the test case cannot be reproduced, the Nock community might not be able to help you.
What is the expected behavior?
Definition of types for
RequestHeaderMatcher
is as this:Specifically, for the last one
{ (fieldValue: string): boolean }
, seems when debugging that it's not the proper type.What is the actual behavior?
When using
matchHeader(name: string, value: RequestHeaderMatcher): this
, and using a function in there asRequestHeaderMatcher
, thefieldValue
is not astring
, but astring[]
If only one header is set for that name, we just receive 1 item in the array.
Possible solution
Update types for
RequestHeaderMatcher
, so that thefieldValue
is actually astring[]
as checked whilst debugging.However, unsure if rest of references to it (found 3 more) behave the same.
How to reproduce the issue
In a project with Typescript, use
matchHeader
to intercept a request, and use a function asRequestHeaderMatcher
. You'll receive astring[]
instead of astring
as types say.Runkit: Example link
Having problem producing a test case? Try and ask the community for help. If the test case cannot be reproduced, the Nock community might not be able to help you.
Does the bug have a test case?
Nope! Not sure how to add something in https://github.com/nock/nock/blob/v13.1.4/types/tests.ts ! Though can try if have some time
Versions
The text was updated successfully, but these errors were encountered: