This repository was archived by the owner on Apr 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Add hasBody to ngResource action configuration #12181
Closed
Closed
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
745d347
Added hasBody to ngResource action configuration
kaufholdr c6f2687
Refined version of hasBody check.
kaufholdr 9e23624
Fixed documentation of ngResource.hasBody configuration.
kaufholdr be8aeeb
Improved documentation of ngResource.hasBody that only POST, PUT and …
kaufholdr c8212ad
Added unit test for ngResource.hasBody.
kaufholdr cf811f5
Added additional test case for hasBody: false on POST,PUT and PATCH
kaufholdr 36ce9f0
Cleanup of hasBody test case variables.
kaufholdr 9139302
Enhanced test case on methods with hasBody true.
kaufholdr 77d9cfa
Further improvement of unit tests for ngResource hasBody.
kaufholdr 4e2a874
Changed expects of hasBody test to refere to a response value instead…
kaufholdr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would these 3 calls fail if
hasBody
was not set? I don't think so (but I haven't tried it either). Can you check?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No they don't fail if hasBody is not set. This is a bug or a feature of ngResource not enforcing the described api.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't found a way to distinguish between request parameters and the request body in httpBackend.
Did I miss something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you pass two params (e.g.
R.post(null, {foo: 'bar'})
), then the first one is interpreted asparams
and the second one asdata
.For example, the following test currently fails, because
{id: -1}
is not undefined. If something similar passes with your PR, then we are good:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sry for the delayed response on my side. I have merged your proposed test case into the test method with hasBody true. The only problem for me was that I couldn't reproduce the failing of the test case. (Even when I used your version.)
Can you see my error or give me the error that you get?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was probably not clear. What I meant is that my test fails with the code currently in master (i.e. without your PR), which is expected, because we don't support the
hasBody
yet. If the test passes with your PR, then it verifies that the feature you added (hasBody
) does indeed work forPUT/POST/PATCH
requests too, so it is good to be merged.