Problem/Motivation
In some cases, it may be required to get back the raw response from Drupal instead of only the json so that headers or other parts of the request can be used if needed.
Steps to reproduce
Proposed resolution
An option to the get method of the JsonApiClient to return the raw response.
Remaining tasks
User interface changes
API changes
the get method options in the JsonApiClient adds a rawResponse option that is a boolean which defaults to false
Data model changes
Issue fork api_client-3391668
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
abhisekmazumdarPicking this up.
Comment #4
abhisekmazumdarLooking for feedback also I will need some inputs for the test case.
Will the Mocks file for this will be txt file or json file is only required.
Comment #5
coby.sher commentedGood start, left a review on the MR.
Comment #6
pratik_kamble@coby.sher Are we expecting raw response to be cached? If yes then I think we should have different key it. Let me know what do you think.
Comment #7
coby.sher commented@pratik_kamble I dont think it should be cached in this case. There is a use case for needing to read the headers from the response in addition to the json from Drupal. I don't think we'll want to cache the response in this case but I could be convinced otherwise.
This might highlight desire for a a per-request opt-out for the cache.
Comment #8
shrutishende commentedComment #9
shrutishende commentedComment #10
pratik_kambleComment #11
pratik_kambleRebased PR. Moving it back to needs review.
Comment #12
coby.sher commentedComment #13
brianperryComment #14
brianperrySetting this back to needs work. I still think we need to come to a final decision about what the changes are, but we do want to return something different than just the response here.
Comment #15
brianperryComment #16
brianperryPushed up an update that resolves recent merge conflicts.
Comment #17
brianperryI've made the remaining updates. Setting to needs review.
Comment #18
coby.sher commentedComment #19
brianperryComment #20
coby.sher commentedComment #21
coby.sher commentedThanks to all of the contributors on this one: abhisekmazumdar, shrutishende, brianperry, and pratik_kamble!
Comment #22
coby.sher commented