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

GET for nonexistent device issue #350

Open
kyork-cl opened this issue May 2, 2017 · 2 comments
Open

GET for nonexistent device issue #350

kyork-cl opened this issue May 2, 2017 · 2 comments

Comments

@kyork-cl
Copy link
Contributor

kyork-cl commented May 2, 2017

I ran into an issue where a library I was testing would crash when issuing a GET /servers/{id}/devices/{id}/ for a device that doesn't exist. In this case, Zetta returns a 404 with the body "Device does not exist". However, the Content-Type header is still application/vnd.siren+json. The library saw the JSON content type and was automatically parsing the body which is not valid JSON.

This isn't a huge issue, but I thought I'd see what your thoughts on fixing this are.

@AdamMagaluk
Copy link
Collaborator

I'm up for fixing it not sure the best approach. Should we return a value JSON body with a error message? Should we change the Content-Type to text/plain? @kevinswiber Any thoughts from the Siren expert.

@kevinswiber
Copy link
Member

As a general preference, I like structured logs. Some of the MUSTs in Siren were relaxed to account for error messages.

{
  "class": ["error", "client-error"],
  "properties": {
    "message": "Device does not exist"
  }
}

I think that should work.

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

3 participants