-
Notifications
You must be signed in to change notification settings - Fork 247
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
Fix params comparisons for post and put requests - Breaking Change #387
Merged
marcbachmann
merged 7 commits into
master
from
fix-params-comparisons-for-post-and-put-requests
Aug 5, 2024
Merged
Fix params comparisons for post and put requests - Breaking Change #387
marcbachmann
merged 7 commits into
master
from
fix-params-comparisons-for-post-and-put-requests
Aug 5, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
marcbachmann
force-pushed
the
fix-params-comparisons-for-post-and-put-requests
branch
4 times, most recently
from
July 31, 2024 15:01
58255c4
to
5ff6d1d
Compare
marcbachmann
changed the title
Fix params comparisons for post and put requests
Fix params comparisons for post and put requests - Breaking Change
Aug 4, 2024
marcbachmann
force-pushed
the
fix-params-comparisons-for-post-and-put-requests
branch
2 times, most recently
from
August 4, 2024 18:13
ef90a74
to
0779d34
Compare
…utes BREAKING CHANGE: Change the parameters of the methods to align it to the one of axios. The last parameter must be a config object with {params, headers} instead of just the headers. If you've always only used two parameters, you won't have to change anything. Methods with data param: - `mock.onPost(url, data, headers)` > `mock.onPost(url, data, {params, headers})` - `mock.onPut(url, data, headers)` > `mock.onPost(url, data, {params, headers})` - `mock.onPatch(url, data, headers)` > `mock.onPatch(url, data, {params, headers})` - `mock.onAny(url, data, headers)` > `mock.onAny(url, {data, params, headers})` Methods without data param: - `mock.onGet(url, {params}, headers)` > `mock.onGet(url, {params, headers})` - `mock.onDelete(url, {params}, headers)` > `mock.onDelete(url, {params, headers})` - `mock.onHead(url, {params}, headers)` > `mock.onHead(url, {params, headers})` - `mock.onOptions(url, {params}, headers)` > `mock.onOptions(url, {params, headers})`
marcbachmann
force-pushed
the
fix-params-comparisons-for-post-and-put-requests
branch
from
August 4, 2024 18:16
0779d34
to
d0f32f9
Compare
An error is reported if one accidentally passes the headers directly instead of `{headers: {}}. e.g. Error: Invalid config attribute Header-test provided to onPatch. Config: {"Header-test":"test-header"}
robinbisping
approved these changes
Aug 5, 2024
marcbachmann
deleted the
fix-params-comparisons-for-post-and-put-requests
branch
August 5, 2024 11:35
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Breaking Change 💥
Change the parameters of the methods to align it to the one of axios.
The last parameter must be a config object with
{params, headers}
instead of just the headers.If you've always only used two parameters, you won't have to change anything.
Methods with data param:
mock.onPost(url, data, headers)
>mock.onPost(url, data, {params, headers})
mock.onPut(url, data, headers)
>mock.onPost(url, data, {params, headers})
mock.onPatch(url, data, headers)
>mock.onPatch(url, data, {params, headers})
mock.onAny(url, data, headers)
>mock.onAny(url, {data, params, headers})
Methods without data param:
mock.onGet(url, {params}, headers)
>mock.onGet(url, {params, headers})
mock.onDelete(url, {params}, headers)
>mock.onDelete(url, {params, headers})
mock.onHead(url, {params}, headers)
>mock.onHead(url, {params, headers})
mock.onOptions(url, {params}, headers)
>mock.onOptions(url, {params, headers})
An error is reported if one accidentally passes the headers directly instead of `{headers: {}}.
e.g.
Error: Invalid config property Header-test provided to onPatch. Config: {"Header-test":"test-header"}