From 0eb422f9a56db92d04cc8e0d5fb4c7d2674d83f1 Mon Sep 17 00:00:00 2001 From: Ayush Newatia Date: Sat, 28 Dec 2024 15:21:26 +1300 Subject: [PATCH 1/2] Fix logic to parse JSON responses in Form wrapper --- 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..504e6fe 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 + content_type, _ = response.headers["content-type"].split(";") + if content_type && parser = @content_types[content_type] + return parser end return super From 7b55df4ab79fca26886f4b5dd75fa3f19956786e Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Sat, 4 Jan 2025 20:52:28 +1300 Subject: [PATCH 2/2] Update lib/async/rest/wrapper/form.rb --- lib/async/rest/wrapper/form.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/async/rest/wrapper/form.rb b/lib/async/rest/wrapper/form.rb index 504e6fe..cf9216b 100644 --- a/lib/async/rest/wrapper/form.rb +++ b/lib/async/rest/wrapper/form.rb @@ -34,8 +34,8 @@ def prepare_request(request, payload) end def parser_for(response) - content_type, _ = response.headers["content-type"].split(";") - if content_type && parser = @content_types[content_type] + media_type, _ = response.headers["content-type"].split(";") + if media_type && parser = @content_types[media_type] return parser end