Skip to content
This repository has been archived by the owner on Mar 26, 2021. It is now read-only.

API errors are not valid JSON #15

Open
romuald opened this issue Oct 4, 2016 · 0 comments
Open

API errors are not valid JSON #15

romuald opened this issue Oct 4, 2016 · 0 comments

Comments

@romuald
Copy link
Member

romuald commented Oct 4, 2016

It seems most of the errors are not returned as JSON but at text/html

% curl -D/dev/stderr http://baobab.local/api/events'?some-filter'

HTTP/1.1 500 INTERNAL SERVER ERROR
Content-Type: text/html; charset=utf-8
Date: Tue, 04 Oct 2016 16:45:48 GMT
Server: nginx
Vary: Cookie
Content-Length: 31
Connection: keep-alive

Sorry but something went wrong

The error should probably be wrapped inside simple JSON structure

MoiTux pushed a commit that referenced this issue Oct 8, 2016
Error will be a dict:
{
  'error': 'This is a message explaing the error',
  'field': 'field_name'
}

if the error is on a 'filter' or 'sort' parameters (query string)
the key 'field' will be set with the name of the faulty parameters

Fix #15
MoiTux pushed a commit that referenced this issue Oct 8, 2016
Error will be a dict:
{
  'error': 'This is a message explaing the error',
  'field': 'field_name'
}

if the error is on a 'filter' or 'sort' parameters (query string)
the key 'field' will be set with the name of the faulty parameters

Fix #15
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant