Skip to content

Add body parser middleware component#72

Open
bergie wants to merge 3 commits intomasterfrom
body_parser
Open

Add body parser middleware component#72
bergie wants to merge 3 commits intomasterfrom
body_parser

Conversation

@bergie
Copy link
Member

@bergie bergie commented Apr 5, 2017

No description provided.

@bergie bergie requested a review from trustmaster April 5, 2017 16:38
@trustmaster
Copy link
Member

This raises the question: do we need all the middleware components in this package? The original intention of this library was to move away from the granularity of https://github.com/djdeath/noflo-express and provide higher-level building blocks with application-specific logic delegated to user's code.

@trustmaster
Copy link
Member

Also, this component should be named BodyParserJSON rather than BodyParser.

@bergie
Copy link
Member Author

bergie commented Apr 6, 2017

Fair point. On the other hand, pretty much every Express app is going to want to have body parser set up.


c.process (input, output) ->
return unless input.hasData 'app'
limit = if input.hasData('limit') then input.getData('limit') else '1mb'
Copy link
Member

Choose a reason for hiding this comment

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

This is race-prone, should use return if input.attached('limit').length and not input.hasData('limit').

@trustmaster
Copy link
Member

@bergie then we should provide BodyParserUrlencoded as well.

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.

2 participants