Skip to content

Commit

Permalink
Prefer frozen empty string.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Jan 28, 2025
1 parent 08051c3 commit 546dec9
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
2 changes: 1 addition & 1 deletion lib/async/http/faraday/adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def with_timeout(task: Async::Task.current)

def encoded_body(response)
body = response.read
return +"" if body.nil?
return "" if body.nil?
content_type = response.headers["content-type"]
return body unless content_type
params = extract_type_parameters(content_type)
Expand Down
1 change: 0 additions & 1 deletion test/async/http/faraday/adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ def get_response(url = bound_url, path = "/index", adapter_options: {})

it "properly handles no content responses" do
expect(get_response.body).to be == ""
expect(get_response.body).not.to be(:frozen?)
end
end

Expand Down

0 comments on commit 546dec9

Please sign in to comment.