Skip to content

Helpers for modifying request headers as middleware#710

Closed
bitemyapp wants to merge 3 commits into
masterfrom
bitemyapp/request-header-helpers
Closed

Helpers for modifying request headers as middleware#710
bitemyapp wants to merge 3 commits into
masterfrom
bitemyapp/request-header-helpers

Conversation

@bitemyapp

@bitemyapp bitemyapp commented Aug 20, 2018

Copy link
Copy Markdown
Contributor

Before submitting your PR, check that you've:

  • Bumped the version number

Yep, minor bump because it's a backwards compatible addition.

After submitting your PR:

  • Update the Changelog.md file with a link to your PR
  • Check that CI passes (or if it fails, for reasons unrelated to your change, like CI timeouts)

Comment thread wai/Network/Wai.hs

-- | apply a function that modifies a request as a 'Middleware'
modifyRequest :: (Request -> Request) -> Middleware
modifyRequest f app req respond = app (f req) $ respond

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You can eta reduce and remove the respond.

Comment thread wai/Network/Wai.hs
type Middleware = Application -> Application


-- | apply a function that modifies a request as a 'Middleware'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you add a @since comment here?

Comment thread wai/Network/Wai.hs
bss <- loop
return $ LI.Chunk bs bss

-- | Apply the provided function to the request header list of the Request.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Perhaps add a comment about this being intended to work with modifyRequest?

@Vlix

Vlix commented Dec 10, 2023

Copy link
Copy Markdown
Contributor

Added to wai-3.2.4

@Vlix Vlix closed this Dec 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants