Skip to content

[5.6] ResourceResponse returns the resource data instead of JSON on Original#22455

Merged
taylorotwell merged 3 commits intolaravel:masterfrom
olivernybroe:Origin-on-resource
Dec 18, 2017
Merged

[5.6] ResourceResponse returns the resource data instead of JSON on Original#22455
taylorotwell merged 3 commits intolaravel:masterfrom
olivernybroe:Origin-on-resource

Conversation

@olivernybroe
Copy link
Copy Markdown
Contributor

By setting original to the model on resources, we can in our tests check directly if the model is the correct one, by just getting the original attribute on the response.
Often I don't want to check if the JSON is formatted correctly, just interested if the model is the correct one.

Pull request send to master instead of 5.5, as commented in #22429

@olivernybroe
Copy link
Copy Markdown
Contributor Author

The reason for setting the original before withResponse is run, is for the ability to still change original in your withResponse function.
So withResponse is always the last thing that touches the response object.

@taylorotwell taylorotwell merged commit 0b4061e into laravel:master Dec 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants