graphiti-api/spraypaint.js

Throws an error when response status is 204 and body is empty

Closed this issue · 0 comments

It looks like Spraypaint can't handle 204 - "No content" codes when POSTing or PATCHing.

In those cases, if the server returns 204 and an empty body Spraypaint tries to parse the body (which is not there) and throws an error, while it should just return the success of the operation.

For reference JSON:API considers 204 to be a valid status both for POST (see here and for PATCH (see here)

Note: If a 204 response is received the client should consider the resource object sent in the request to be accepted by the server, as if the server had returned it back in a 201 response.