discoveryjs/browser-extension-json-discovery

Support custom content type

lavcraft opened this issue · 4 comments

Hello everyone. I Love json discovery, but can't use it with my WIKI HATEOAS API, because it return json with application/hal+json content type

How to enable Json Discovery extension for Content-type: application/hal+json response header?

Oh sorry. It's my fault..

exdis commented

What was the problem? JSON-discovery should check if the content is JSON despite of any headers. And if the content could be parsed then the plugin activates.
Let me know if something works wrong)

What was the problem? JSON-discovery should check if the content is JSON despite of any headers. And if the content could be parsed then the plugin activates.
Let me know if something works wrong)

Yeah. Thats right. Sorry for the trouble and thank you for the answer :)
My problem in software bug (it return json with text/html content type, and in this case json discovery don't try to parse response body )

exdis commented

Yep, discovery could skip content if there is no <pre> tag in it. And there might not be this tag in content when the browser treats it as an HTML page. This made because of the way browsers working with JSON content. So yes, I think JSON-like headers in the response would be a proper solution.