Permalink
Browse files

Tap, tap goes the middleware

  • Loading branch information...
jeremy committed Mar 1, 2012
1 parent f9995ce commit ceb66b61264657898cd6608c7e9ed78072169664
Showing with 1 addition and 4 deletions.
  1. +1 −4 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

This comment has been minimized.

Show comment
Hide comment
@tenderlove

tenderlove Mar 1, 2012

Member

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

Member

tenderlove replied Mar 1, 2012

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

@josevalim

This comment has been minimized.

Show comment
Hide comment
@josevalim

josevalim Mar 1, 2012

Contributor

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

Contributor

josevalim replied Mar 1, 2012

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

@fxn

This comment has been minimized.

Show comment
Hide comment
@fxn

fxn Mar 1, 2012

Member

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.

Member

fxn replied Mar 1, 2012

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

This comment has been minimized.

Show comment
Hide comment
@sobrinho

sobrinho Mar 1, 2012

Contributor

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

:)

Contributor

sobrinho replied Mar 1, 2012

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

This comment has been minimized.

Show comment
Hide comment
@jeremy

jeremy Mar 1, 2012

Member

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

Member

jeremy replied Mar 1, 2012

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

@homakov

This comment has been minimized.

Show comment
Hide comment
@homakov

homakov Mar 1, 2012

Contributor

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 :(

Contributor

homakov replied Mar 1, 2012

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

This comment has been minimized.

Show comment
Hide comment
@josevalim

josevalim Mar 1, 2012

Contributor
Contributor

josevalim replied Mar 1, 2012

@fxn

This comment has been minimized.

Show comment
Hide comment
@fxn

fxn Mar 1, 2012

Member

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

Member

fxn replied Mar 1, 2012

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

@homakov

This comment has been minimized.

Show comment
Hide comment
@homakov

homakov Mar 2, 2012

Contributor

#5239 my time to troll jaja

Contributor

homakov replied Mar 2, 2012

#5239 my time to troll jaja

Please sign in to comment.