Skip to content

Commit

Permalink
Fix rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
ericproulx committed Jan 5, 2024
1 parent 63c6910 commit cbe85b1
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions spec/support/chunked_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ def close
private

# Do nothing as this class does not support trailer headers.
def yield_trailers
end
def yield_trailers; end
end

class TrailerBody < Body
Expand All @@ -58,15 +57,15 @@ def call(env)
status, headers, body = response = @app.call(env)

if !Rack::Utils::STATUS_WITH_NO_ENTITY_BODY.key?(status.to_i) &&
!headers[Rack::CONTENT_LENGTH] &&
!headers[Rack::TRANSFER_ENCODING]
!headers[Rack::CONTENT_LENGTH] &&
!headers[Rack::TRANSFER_ENCODING]

headers[Rack::TRANSFER_ENCODING] = 'chunked'
if headers['trailer']
response[2] = TrailerBody.new(body)
else
response[2] = Body.new(body)
end
response[2] = if headers['trailer']
TrailerBody.new(body)
else
Body.new(body)
end
end

response
Expand Down

0 comments on commit cbe85b1

Please sign in to comment.