From 2a191ea051b20a492a3325413dcdca11b593ba50 Mon Sep 17 00:00:00 2001 From: Christopher Burnett Date: Wed, 22 Aug 2012 16:34:58 -0700 Subject: [PATCH] Don't attempt to parse bodies that only contain spaces. Rails 2.x head responses return a single space as the body. This is due to a Safari bug where the headers are not passed if the content length is zero. --- lib/twitter/response/parse_json.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/twitter/response/parse_json.rb b/lib/twitter/response/parse_json.rb index cc125c021..3679fab72 100644 --- a/lib/twitter/response/parse_json.rb +++ b/lib/twitter/response/parse_json.rb @@ -7,7 +7,7 @@ class ParseJson < Faraday::Response::Middleware def parse(body) case body - when '', nil + when /\A^\s*$\z/, nil nil when 'true' true