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

Failure message vague when content type not set, could be improved #45

Open
daluu opened this issue Jul 24, 2015 · 1 comment
Open

Failure message vague when content type not set, could be improved #45

daluu opened this issue Jul 24, 2015 · 1 comment

Comments

@daluu
Copy link
Collaborator

daluu commented Jul 24, 2015

FYI, when one makes an API call without setting the content type header

Content-Type: application/x-www-form-urlencoded

the response is a failure with message _Invalid phone number._ I found this out twice, once while using a browser extension based REST client to test out API and again while using XmlHttpRequest while building a browser extension for the API.

Not all HTTP request tools/libraries auto-set content type (to form for POST requests) unlike curl. Granted developer should know to set it, but sometimes we forget. The error returned isn't very useful for debugging. Perhaps in future should enhance to return a proper failure message in this case like

_Content type header not set or wrong type used. Please use application/x-www-form-urlencoded_.

@robsilva
Copy link

This totally tripped me. Thanks for sharing it.

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

No branches or pull requests

2 participants