lib/hanami/api/block/context.rb in hanami-api-0.1.1 vs lib/hanami/api/block/context.rb in hanami-api-0.1.2
- old
+ new
@@ -128,12 +128,10 @@
end
# @since 0.1.0
# @api private
#
- # rubocop:disable Metrics/AbcSize
- # rubocop:disable Metrics/MethodLength
def call
case caught
in String => body
[status, headers, [body]]
in Integer => status
@@ -145,18 +143,16 @@
# the current pattern matching context.
# When that happens, the body that was manually set is ignored,
# which results in a bug.
[status, headers, [self.body || http_status(status)]]
# rubocop:enable Style/RedundantSelf
- in [Integer, String] => response
- [response[0], headers, [response[1]]]
- in [Integer, Hash, String] => response
- headers.merge!(response[1])
- [response[0], headers, [response[2]]]
+ in [Integer => status, String => body]
+ [status, headers, [body]]
+ in [Integer => status, Hash => caught_headers, String => body]
+ headers.merge!(caught_headers)
+ [status, headers, [body]]
end
end
- # rubocop:enable Metrics/MethodLength
- # rubocop:enable Metrics/AbcSize
private
# @since 0.1.0
# @api private