From 15244c111c36d507beae3b5420ffd06658158a52 Mon Sep 17 00:00:00 2001 From: Ayush Newatia Date: Sat, 4 Jan 2025 20:53:49 +1300 Subject: [PATCH] Fix logic to parse JSON responses in Form wrapper (#15) --- lib/async/rest/wrapper/form.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/async/rest/wrapper/form.rb b/lib/async/rest/wrapper/form.rb index 4ae5a23..cf9216b 100644 --- a/lib/async/rest/wrapper/form.rb +++ b/lib/async/rest/wrapper/form.rb @@ -34,10 +34,9 @@ def prepare_request(request, payload) end def parser_for(response) - if content_type = response.headers["content-type"] - if parser = @content_types[content_type] - return parser - end + media_type, _ = response.headers["content-type"].split(";") + if media_type && parser = @content_types[media_type] + return parser end return super