discoveryjs / browser-extension-json-discovery

A browser extension (Chrome, Edge, Firefox) that changes the way you're viewing JSON
305 stars 11 forks source link

Support custom content type #51

Closed lavcraft closed 4 years ago

lavcraft commented 4 years ago

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?

lavcraft commented 4 years ago

Oh sorry. It's my fault..

exdis commented 4 years ago

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)

lavcraft commented 4 years ago

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 4 years ago

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.