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

Micropub: Error responses are not JSON #1506

Closed
cweiske opened this issue Sep 8, 2016 · 1 comment
Closed

Micropub: Error responses are not JSON #1506

cweiske opened this issue Sep 8, 2016 · 1 comment

Comments

@cweiske
Copy link
Contributor

cweiske commented Sep 8, 2016

While trying to do this:

Send an invalid micropub request to create a new post

I encountered this error:

Server responded with a status code of 500 and plain-text error message "Couldn't create note"

Some other notes:

The micropub draft specification section 3.8 Error Response states:

If an error body is returned, the response body must be encoded as a [JSON] object and include at least a single property named error with the value set to one of the below:

Such an error can be forced by making the content POST parameter an array:

$ curl -X POST -H 'Authorization: Bearer foo' -d h=entry -d 'content[]=test' http://known.example.org/micropub/endpoint
HTTP/1.0 500 Internal Server Error
...
Content-Type: text/html

Couldn't create note
@cweiske
Copy link
Contributor Author

cweiske commented Sep 22, 2016

Same error occurs when the access token is invalid

kylewm pushed a commit that referenced this issue Sep 25, 2016
Conform to the spec by sending out JSON error responses:

- When the access token is invalid
- When some error occurs, e.g. a post could not be saved

The micropub endpoint now also sends out a HTTP 500 status code
by default unless that's overriden later.
This helps when something crashes during processing.

Resolves: #1506
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

1 participant