Comments (9)
I went ahead and took a stab at taking care of this. Please review PR #61
from redux-json-api.
π
from redux-json-api.
I have the same issue.
from redux-json-api.
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.
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.
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.
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.
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.
I forgot to close the issue π Expected it to be closed automatically.
from redux-json-api.
Related Issues (20)
- Workwith Immutable.js HOT 1
- Best Practice for 422 or 500 Errors HOT 2
- Could you guys give me an example of using json-redux-api with Axios? HOT 17
- Update hydrateStore doc example
- resource.type vs collection endpoint uris HOT 5
- Add flow-typed
- Update set up configuration page to v2 Standards HOT 8
- Delete resource endpoint appears to use relative pathing HOT 5
- Links to state HOT 5
- Update state at next readEndpoint HOT 3
- Custom URL construction HOT 11
- Action type is undefined HOT 4
- Pagination URLs can be objects.
- Unable to start expo due to Node standard library dependency of keykey HOT 1
- angular @angular-redux process not defined HOT 6
- babel-runtime must be added manually to build
- Media Types (Content Negotiation) for mutlipart/form-data content type. Request for implementation. HOT 1
- Is there any known live fork of this repo? HOT 2
- getRelatedResources crashes if relationship data is null HOT 2
- Export instance of axios that used in requests
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from redux-json-api.