Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Tap, tap goes the middleware

  • Loading branch information...
commit ceb66b61264657898cd6608c7e9ed78072169664 1 parent f9995ce
@jeremy jeremy authored
Showing with 1 addition and 4 deletions.
  1. +1 −4 actionpack/lib/action_dispatch/middleware/request_id.rb
View
5 actionpack/lib/action_dispatch/middleware/request_id.rb
@@ -19,10 +19,7 @@ def initialize(app)
def call(env)
env["action_dispatch.request_id"] = external_request_id(env) || internal_request_id
- status, headers, body = @app.call(env)
-
- headers["X-Request-Id"] = env["action_dispatch.request_id"]
- [ status, headers, body ]
+ @app.call(env).tap { |status, headers, body| headers["X-Request-Id"] = env["action_dispatch.request_id"] }
end
private

9 comments on commit ceb66b6

@tenderlove
Owner

Pretty sure that's more than 80 columns. :trollface:

@josevalim
Owner

Yes, we should probably use s, h and b as variables to ensure it won't be more than 80 columns. :trollface:

@fxn
Owner

Problem are 2D editors, if that line could be rolled in a 3rd dimension it would fit even in the screen of a Sinclair Spectrum.

@sobrinho

You could break into do/end block:

@app.call(env).tap do |status, headers, body|
  headers["X-Request-Id"] = env["action_dispatch.request_id"]
end

:)

@jeremy
Owner

Too many blocks and hash lookups. This is why Rails is slow. :trollface:

@homakov

jeremy, are you talkinng to sobrinho? His code looks much clearer.
y all are trying to code using 1 line. it makes things more obscure :(

@josevalim
Owner
@fxn
Owner

To be honest I don't have a Sinclair Spectrum either, more of an Amstrad guy over here :beer:

@homakov

#5239 my time to troll jaja

Please sign in to comment.
Something went wrong with that request. Please try again.