You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are on Ruby 2.7.6, but verified the behavior of JSON.parse("") on Ruby 3.2 and it's the same.
Expected Behavior
The API shouldn't attempt to parse the empty body
Current Behavior
The API ignores the lack of a response body and call JSON.parse regardless of the response code or the body.
Steps to Reproduce
Use the Ruby client to delete a valid datasource_entry via the /v1/spaces/[SPACE_ID]/datasource_entries/[entry_id] route
The client will trigger a unexpected token at '' (JSON::ParserError) exception
The text was updated successfully, but these errors were encountered:
cykod
changed the title
Deleting a datasource_entry results in a JSON:ParseError from attempting to parse the empty string
Deleting a datasource_entry results in a JSON::ParseError from attempting to parse the empty string
Jan 4, 2023
This likely happens on other DELETE requests, but I'm currently only running into it attempting to delete datasource_entries via the API.
Successfully calling DELETE on a datasource_entity results in a response code of 204 (
No Content
) and an empty body which presents as the empty string inrest-client
. The API client then attempt to callJSON.parse
on the empty string, which results in a thrown exception ofJSON::ParserError (859: unexpected token at '')
caused by the call at https://github.com/storyblok/storyblok-ruby/blob/1f018c0965f754d2ea47424dd5e5cc153c4a8404/lib/storyblok/client.rb#L174 which calls https://github.com/storyblok/storyblok-ruby/blob/1f018c0965f754d2ea47424dd5e5cc153c4a8404/lib/storyblok/client.rb#L226-L228Regardless of the return value of the request.
We are on Ruby 2.7.6, but verified the behavior of
JSON.parse("")
on Ruby 3.2 and it's the same.Expected Behavior
The API shouldn't attempt to parse the empty body
Current Behavior
The API ignores the lack of a response body and call
JSON.parse
regardless of the response code or the body.Steps to Reproduce
datasource_entry
via the/v1/spaces/[SPACE_ID]/datasource_entries/[entry_id]
routeunexpected token at '' (JSON::ParserError)
exceptionThe text was updated successfully, but these errors were encountered: