twilio / twilio-go

A Go package for communicating with the Twilio API.
MIT License
278 stars 40 forks source link

The request validator code doesn't work for `application/x-www-form-urlencoded` POST requests #137

Closed peter-assi closed 2 years ago

peter-assi commented 2 years ago

Issue Summary

According to the docs the check here should only happen for application/json request https://github.com/twilio/twilio-go/blob/main/client/request_validator.go#L56 thus alway returning false for form encoded request since they don't send the bodySHA256 param.

Also according to the docs, the body params should be concatenated to the url. The code here https://github.com/twilio/twilio-go/blob/main/client/request_validator.go#L36 needs to be changed to

        paramSlc = append(paramSlc, fmt.Sprintf("%s%s", k, v[0]))

As it is now it will put [] around the values since url.Parse returns the value as an array. Ie instead of https://example.comparamvalue the result will be https://example.comparam[value]

eshanholtz commented 2 years ago

This issue has been added to our internal backlog to be prioritized. Pull requests and +1s on the issue summary will help it move up the backlog.