-
-
Notifications
You must be signed in to change notification settings - Fork 24
add meta parameter for createResourceAt() #106
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f5de831
add meta parameter fot createResourceAt()
dan12411 173d12e
add missing meta parameter
dan12411 97377b0
add creating_resource_with_meta_test.dart
dan12411 fc14cb9
Merge branch 'master' into add-meta-to-createResourceAt
dan12411 9ae58bd
use TestHttpHandler to check request actually has the meta property
dan12411 d5c8c17
remove unnecessary expects
dan12411 58c0f7d
use a simple 201 instead
dan12411 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import 'package:json_api/client.dart'; | ||
import 'package:json_api/document.dart'; | ||
import 'package:json_api/http.dart'; | ||
import 'package:test/test.dart'; | ||
|
||
import '../../helper/test_http_handler.dart'; | ||
|
||
void main() async { | ||
test('request actually has the meta property', () async { | ||
final handler = TestHttpHandler(); | ||
final client = JsonApiClient(handler); | ||
|
||
final uri = Uri.parse('https://github.com/f3ath/json-api-dart'); | ||
final person = | ||
Resource('people', '123', attributes: {'name': 'Te Cheng Hung'}); | ||
final meta = {'friend': 'Martin Fowler'}; | ||
|
||
handler.nextResponse = HttpResponse(201); | ||
await client.createResourceAt(uri, person, meta: meta); | ||
|
||
final request = handler.requestLog.first; | ||
expect(request.body, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's leave just this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok |
||
'{"data":{"type":"people","id":"123","attributes":{"name":"Te Cheng Hung"}},"meta":{"friend":"Martin Fowler"}}'); | ||
}); | ||
} |
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.
Looks like the argument is not passed down to
_resourceDoc()
.Please add a unit test supporting this change. It would belong in this folder https://github.com/f3ath/json-api-dart/tree/master/test/unit/client
You can use the ones that are there already as an example.
Uh oh!
There was an error while loading. Please reload this page.
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.
OK, i will fix it, thank you!
Uh oh!
There was an error while loading. Please reload this page.
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.
should I use naming documentMeta replace meta? 🤔
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. Please disregard that comment. I removed it once realized that resource meta would be in the resource object itself. So just meta is OK.
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.
Get it!