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

Command icon 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

coby.sher created an issue. See original summary.

abhisekmazumdar’s picture

Assigned: Unassigned » abhisekmazumdar

Picking this up.

abhisekmazumdar’s picture

Assigned: abhisekmazumdar » Unassigned
Status: Active » Needs review

Looking 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.

coby.sher’s picture

Status: Needs review » Needs work

Good start, left a review on the MR.

pratik_kamble’s picture

@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.

coby.sher’s picture

@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.

shrutishende’s picture

Assigned: Unassigned » shrutishende
Status: Needs work » Active
shrutishende’s picture

Assigned: shrutishende » Unassigned
Status: Active » Needs review
pratik_kamble’s picture

Status: Needs review » Reviewed & tested by the community
pratik_kamble’s picture

Status: Reviewed & tested by the community » Needs review

Rebased PR. Moving it back to needs review.

coby.sher’s picture

Status: Needs review » Reviewed & tested by the community
brianperry’s picture

brianperry’s picture

Status: Reviewed & tested by the community » Needs work

Setting 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.

brianperry’s picture

Assigned: Unassigned » brianperry
brianperry’s picture

Pushed up an update that resolves recent merge conflicts.

brianperry’s picture

Assigned: brianperry » Unassigned
Status: Needs work » Needs review

I've made the remaining updates. Setting to needs review.

coby.sher’s picture

Status: Needs review » Needs work
brianperry’s picture

Status: Needs work » Needs review
coby.sher’s picture

Status: Needs review » Reviewed & tested by the community
coby.sher’s picture

Thanks to all of the contributors on this one: abhisekmazumdar, shrutishende, brianperry, and pratik_kamble!

coby.sher’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.