Skip to content

Default handler responses returned are invalid JSON [Was: JSON representation issue when resource does not exist] #300

@MasterMastic

Description

@MasterMastic

I described my issue on Stack Overflow over here, and the more I think about it, the more it seems like a bug.
I don't know if it's okay to just link it so here's a quick brief of the issue.

The following resource:

(resource
  :available-media-types ["application/json"]
  :exists? false
  :handle-ok {:hello "world"})

Yields a 404 response with the following text:

There was an error parsing JSON data

Unexpected token R in JSON at position 0

Providing a :handle-not-found is ignored as well, checked for regression on versions 0.15.2, 0.15.1, 0.15.0 but same results, and it only happens with the "application/json" media type. E.g. "application/edn" works perfectly. No Ring middleware is used (not even site/api defaults).

And as I wrote over there, I'm not sure if I just misused the library but it does seem like a bug or at least something to enhance. Still, if that's the case I would really appreciate some help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions