balanced / balanced-api

Balanced API specification.
220 stars 72 forks source link

API 500s When It Should Be 400ing #583

Open cieplak opened 10 years ago

cieplak commented 10 years ago
➜  ~  curl https://api.balancedpayments.com/customers \
     -H "Accept: application/vnd.api+json;revision=1.1" \
     -u ak-test-1PPfI4CmXSaOHFgIYzWdA5fpdkYe9mvLL: \
     -d 'name=fooey' -d 'card=CC1AmIYgsxXFp7EoX2X3yrc5'                 
{
  "code": 500, 
  "description": "'unicode' object has no attribute 'get'", 
  "name": "Internal Server Error"
}%     
mjallday commented 10 years ago

Why is it exposing the error message?

matthewfl commented 10 years ago

I think this is related to an error that I was seeing before in some local testing.

Assuming that this error is related, then the 500 is coming from midlr, where midlr is expecting that the card type is a dict instead of a string, which means that when it tries to sanitize payload by essentially doing {}.get('number') it fails because it is doing .get on a unicode string.