Skip to content

Commit

Permalink
Fix issue that has popped up with play/pause
Browse files Browse the repository at this point in the history
  • Loading branch information
mattdrewitt authored Sep 5, 2024
1 parent 577fcf7 commit 0b7e611
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/rspotify/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,12 @@ def send_request(verb, path, *params)
end

return response if raw_response
JSON.parse(response) unless response.nil? || response.empty?

begin
JSON.parse(response) unless response.nil? || response.empty?
rescue JSON::ParserError, TypeError => e
response.to_s # Fall back to raw body when the response is not actually a valid JSON response
end
end

# Added this method for testing
Expand Down

0 comments on commit 0b7e611

Please sign in to comment.