Skip to content

Commit

Permalink
[Fix] Rescue empty body responses (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
araluce authored Sep 16, 2024
1 parent 5ad8e1d commit 9ab1c66
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/calendlyr/resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,12 @@ def request(url, req_type, body: {}, params: {}, base_url: Client::BASE_URL)
def handle_response(response)
return true unless response.read_body

body = JSON.parse(response.read_body)
body = begin
JSON.parse(response.read_body)
rescue
{}
end

if ERROR_CODES.include? response.code
raise ResponseErrorHandler.new(response.code, body).error
else
Expand Down

0 comments on commit 9ab1c66

Please sign in to comment.