-
-
Notifications
You must be signed in to change notification settings - Fork 733
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DataMatcher
type does not allow arrays be used for POST bodies
#1724
Labels
Comments
mastermatt
added a commit
to mastermatt/nock
that referenced
this issue
Sep 19, 2019
Fixes: nock#1724 Closes: nock#1723 Updates the JSONish type using inspiration from the thread on adding a JSON type to TS. microsoft/TypeScript#1897 (comment) This change does a couple sublet things: - Adds `undefined` to scalar values allowed in arrays or as values in objects. This allows for interfaces with optional keys to be passed in. ref nock#1723 - Splits out top-level array and objects into their interfaces so they could be used directly. Allows enforcing non-arrays for `.query`. - `RequestBodyMatcher` now extends the array and map types instead of the raw `DataMatcher`. Allowing arrays fixes nock#1724. This also ensures that booleans, numbers, and `null` are not considered valid.
mastermatt
added a commit
that referenced
this issue
Sep 20, 2019
* fix(types): data matcher for body and query. Fixes: #1724 Closes: #1723 Updates the JSONish type using inspiration from the thread on adding a JSON type to TS. microsoft/TypeScript#1897 (comment) This change does a couple sublet things: - Adds `undefined` to scalar values allowed in arrays or as values in objects. This allows for interfaces with optional keys to be passed in. ref #1723 - Splits out top-level array and objects into their interfaces so they could be used directly. Allows enforcing non-arrays for `.query`. - `RequestBodyMatcher` now extends the array and map types instead of the raw `DataMatcher`. Allowing arrays fixes #1724. This also ensures that booleans, numbers, and `null` are not considered valid.
🎉 This issue has been resolved in version 11.3.5 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm moving the conversation from another issue to it's own ticket at it turned out to not be related to the original issue.
First comment #1708 (comment) by @ctotheameron
This issue is an extension of #1702 which was partially fixed in #1703.
The
DataMatcher
type is used to type the optional body argument of "method" methods on Scopes (.post, .put, etc.) as well as typing the argument passed toInterceptor.query
.Of note is that arrays are valid types to pass
.post
, but it is not valid for.query
.The text was updated successfully, but these errors were encountered: