Skip to content

Commit

Permalink
Don't attempt to parse bodies that only contain spaces.
Browse files Browse the repository at this point in the history
  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.
  • Loading branch information
Christopher Burnett committed Aug 22, 2012
1 parent d07cbf2 commit 2a191ea
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/twitter/response/parse_json.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2a191ea

Please sign in to comment.