Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rack.response_finished to Rack::Lint. #1952

Merged
merged 2 commits into from Aug 26, 2022
Merged

Conversation

ioquatix
Copy link
Member

@ioquatix ioquatix commented Aug 26, 2022

This updates Rack::Lint to validate that rack.response_finished is an
array of callables when present in the env. e.g. procs, lambdas, or
objects that respond to call.

This validates that:

  • rack.response_finished is an array
  • The contents of the array all respond to call

And specifies that:

  • The callback will receive (env, status, headers, error) as arguments.

Bringing #1802 to completion according to @tenderlove's recommendations/requirements.

@ioquatix ioquatix changed the title Add rack.response_finished to Rack::Lint Add rack.response_finished to Rack::Lint. Aug 26, 2022
@ioquatix ioquatix force-pushed the rack-response-finished branch 4 times, most recently from 6672eb2 to 9c88c6a Compare August 26, 2022 07:39
This updates Rack::Lint to validate that `rack.response_finished` is an
array of callables when present in the `env`. e.g. procs, lambdas, or
objects that respond to `call`.

This validates that:

* `rack.response_finished` is an array
* The contents of the array all respond to `call`
Copy link
Contributor

@jeremyevans jeremyevans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't check that if rack.response_finished is present, each entry in the array, if called, is called with the four arguments. I'm not sure whether it is not worth wrapping each callable in the array in a wrapper that does such checks, but we do take similar steps in other cases (e.g. InputWrapper, ErrorWrapper, StreamWrapper).

SPEC.rdoc Outdated Show resolved Hide resolved
@ioquatix ioquatix merged commit 856c4f9 into main Aug 26, 2022
@ioquatix ioquatix deleted the rack-response-finished branch August 26, 2022 22:25
casperisfine pushed a commit to Shopify/pitchfork that referenced this pull request Mar 11, 2024
Fix: #97
Ref: rack/rack#1952

Similar to `rack.after_reply` but this one is part of the Rack
spec and expect some arguments.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants