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 method for validation of JSON body #424

Merged
merged 3 commits into from Jul 12, 2018
Merged

Conversation

cjcodes
Copy link
Member

@cjcodes cjcodes commented Jul 5, 2018

If we want to validate requests that have a POST body payload, this allows us to compare it against the bodySHA256 parameter that will be sent from the Twilio Webhook.

@cjcodes cjcodes requested a review from ekarson July 5, 2018 16:46
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.

looks good, left one small comment

params.put("CallSid", "CA1234567890ABCDE");
params.put("Caller", "+14158675309");
params.put("Digits", "1234");
params.put("From", "+14158675309");
params.put("To", "+18005551212");

String signature = "RSOYDt4T1cUTdK1PDd93/VVr8B8=";
signature = "RSOYDt4T1cUTdK1PDd93/VVr8B8=";
Copy link
Contributor

Choose a reason for hiding this comment

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

move this to where signature is declared, since it never changes?

@cjcodes
Copy link
Member Author

cjcodes commented Jul 5, 2018

Done!

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.

🎉

@cjcodes
Copy link
Member Author

cjcodes commented Jul 10, 2018

@ekarson Updated this PR, since requests can't have both params and bodies.

@cjcodes cjcodes merged commit cde66df into master Jul 12, 2018
@cjcodes cjcodes deleted the json-body-validator branch July 12, 2018 17:01
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.

None yet

2 participants