Coder Social home page Coder Social logo

Comments (9)

DanBradbury avatar DanBradbury commented on May 20, 2024 2

I went ahead and took a stab at taking care of this. Please review PR #61

from redux-json-api.

Petesta avatar Petesta commented on May 20, 2024 1

πŸ˜„

from redux-json-api.

Realtin avatar Realtin commented on May 20, 2024

I have the same issue.

from redux-json-api.

egeriis avatar egeriis commented on May 20, 2024

That's interesting. I never noted that the spec notes:

Any requests that contain content

That's definitely an oversight.

I reckon a quick fix would be a check on status code, as you suggest. The correct solution would probably be to check if there is any data in the response body, but I am not even sure that JSON API allows GET, PATCH and POST response body to be empty.

Are you up for making a PR @DanBradbury?

from redux-json-api.

DanBradbury avatar DanBradbury commented on May 20, 2024

When updating relationships w/ PATCH it may return a 204

If an update is successful and the server doesn’t update any attributes besides those provided, the server MUST return either a 200 OK status code and response document (as described above) or a 204 No Content status code with no response document.

The same is true for creating resources (POST); must return either 201 or 204 on success

I wasn't aware of any 204s until this morning and can submit a PR to take a look at the status code. I'm under the impression that whenever we have a 204 status the body should be empty (not sure if there is a case where you'd return any other status code with an empty body)

from redux-json-api.

egeriis avatar egeriis commented on May 20, 2024

not sure if there is a case where you'd return any other status code with an empty body

No, I think you're right. At least that would fall out of scope, as the API doesn't follow the spec then.

from redux-json-api.

zweck avatar zweck commented on May 20, 2024

I'm having this same issue, our JSON-API serializer (https://github.com/fortunejs/fortune-json-api) seems to return 204 for updates by default which is also throwing:

Uncaught (in promise) TypeError: Cannot read property 'indexOf' of null(..)
            (anonymous function)    @   utils.js:32
            (anonymous function)    @   utils.js:31

from redux-json-api.

evolve2k avatar evolve2k commented on May 20, 2024

Pull request #61 which resolves this issue has been merged in the last day or so.

@egeriis This issue can now be closed πŸšͺ

from redux-json-api.

egeriis avatar egeriis commented on May 20, 2024

I forgot to close the issue πŸ™‚ Expected it to be closed automatically.

from redux-json-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.