gotwilio
gotwilio copied to clipboard
Supporting GET request signature validation
According to this code, only POST requests are supported. However, Twilio accesses fax media files using a GET request. As far as I can see and have roughly tested, simply allowing the function to continue even if its a GET request correctly validates the signature.
https://github.com/sfreiberg/gotwilio/blob/06f83df0c6872b46b84798e2e1c4530729c60a8a/util.go#L62-L69
Browsing the Twilio documentation, it says that appending the full raw query to the URL is sufficient. Likewise, r.URL.String() includes the entire raw query. Any POST parameters are appended to that. If we call ParseForm on a GET request, the request Body is not read, and r.PostForm is initialized to a non-nil, empty value. So GenerateSignature still functions as it should.