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 a request body validator #365

Merged
merged 3 commits into from
Jul 12, 2018
Merged

Add a request body validator #365

merged 3 commits into from
Jul 12, 2018

Conversation

cjcodes
Copy link
Member

@cjcodes cjcodes commented Jul 10, 2018

This PR:

  • Adds a request body validator that accepts a string, for validating POST body that's not form data
  • Gracefully (backwards-compatibly) removes unsupported, useless code from the Express Middleware
  • Refactors tests to not stand up an express server, mocking requests instead

authToken,
request.header('X-Twilio-Signature'),
webhookUrl,
request.body || {}
Copy link
Contributor

Choose a reason for hiding this comment

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

wait does request.body contain the params?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yup, same name. In express, request.body is auto-converted based on the content-type.

I think that's your question, right?

Copy link
Contributor

@ekarson ekarson left a comment

Choose a reason for hiding this comment

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

yes

@cjcodes cjcodes merged commit aa56ed9 into master Jul 12, 2018
@cjcodes cjcodes deleted the post-body-validation branch July 12, 2018 18:45
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