-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
204 should be considered as a success #46
Comments
Hi thanks for reporting this. Could you provide a code sample or at least a sketch to help me reproduce the problem? If so, i can probably get a fix out this week. Otherwise it may be a while, since I'm not sure what the exact problem is based in your description. Thanks! And thanks again for reporting the issue! |
Ok so i took a quick look at what might cause this error. I may be confused about where this error is arising, so i eagerly await sample code. If it's the error I'm guessing it is, the problem is that the app defaults to a json format in the api client. The default api client is configurable to allow changing that value. The README suggests using this line to configure the api client when you kick off your saga
I suggest you try changing that to this
This will call response.text () instead of response.json () in ApiClient.js which may resolve the problem. If not post more details here and i can help troubleshoot further |
Ugh too hard to type this on my phone I'll edit the above comment on a laptop |
Also note that you can use the fetchconfig param in your action creators to achieve the same thing on one endpoint instead of on all of them. You probably only want the text format for the endpoints returning 204. The other alternative is copy pasting ApiClient.js into your codebase and customizing it. I'd hot go that route and create useful improvements, please make a pull request! Id love to see how your use case works. |
I prepared pull request with fix of this bug: #47 |
Django REST Framework is a good platform to build sample CRUD backend app. https://tests4geeks.com/django-rest-framework-tutorial/ |
You can see my progress at https://github.com/devvmh/demo-redux-crud-store |
When REST server response HTTP 204 No Content, you throw error "Unexpected end of JSON input". But, it is not error, it is success.
The text was updated successfully, but these errors were encountered: