Skip to content

hydraAdmin expects json body of 204 post response #156

Open
@andytson-inviqa

Description

@andytson-inviqa

I've been trying to implement a bulk action in react-admin which uses the Symfony Messenger integration in the backend api-platform api. This is from following:
https://api-platform.com/docs/core/messenger/
https://marmelab.com/react-admin/Actions.html#using-a-custom-action-creator

At first I used http status 202 as the first guide mentioned, but api-doc-parser's fetchJsonLd expects a JSON response from that, as it returns a Content-Type: application/ld+json ... and doesn't like it otherwise.
https://github.com/api-platform/api-doc-parser/blob/master/src/hydra/fetchJsonLd.js#L32

I changed the http status to 204, however that then causes hydraClient.js convertHydraResponseToReactAdminResponse to try to parse a undefined json property:
https://github.com/api-platform/admin/blob/master/src/hydra/hydraClient.js#L327

Should convertHydraResponseToReactAdminResponse be updated to handle this http status for POST/PUT, as it does inherently for DELETE? It then allows me to let react-admin continue on with a chosen side effect.

e.g.

      default:
        if (response.status == 204) {
          return Promise.resolve({data: {id: null}});
        }
        return Promise.resolve( ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions