-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
JSON parsing failed #729
Comments
I am not able to reproduce your error using the following curl command: Can you provide the actual error that you are getting? |
I tested that and everything works well for me. When I make the POST request with that data, I receive a response like this: {
"id": "42982700",
"isbn": "4545454",
"title": "Book Three"
} And also I added log to check the errors when encode the json. err := json.NewEncoder(w).Encode(book)
if err != nil {
log.Println(err)
} |
It could be a problem with your |
Indeed, I am using postman, my environment is, |
Does postman persist your application? Does it keep it running in the background? If not, and it restarts it for every request, that would remove the data that you just submitted from memory since you are not using a persistent data store. I have never used postman so I have no idea how it works, but it seems like this is not an issue with the mux library. |
I confirm that I clean up the process every time I test, and then run a new instance, the same program, simulated with other tools, such as RApidApi (Paw), there is no problem, it seems to be a problem with postman, thank you for your answer |
Thank you for your answer |
Is there an existing issue for this?
Current Behavior
// Request sample
// {
// "isbn":"4545454",
// "title":"Book Three",
// "author":{"firstname":"Harry","lastname":"White"}
// }
Postman simulates the post event and calls createBook
JSON parsing failed
Expected Behavior
json decode success
Steps To Reproduce
1.mac os Monterey
2.
json data
// Request sample
// {
// "isbn":"4545454",
// "title":"Book Three",
// "author":{"firstname":"Harry","lastname":"White"}
// }
Postman simulates the post event and calls createBook
JSON parsing failed
Anything else?
No response
The text was updated successfully, but these errors were encountered: