Merge pull request #1322 from linrock/json-api
Detect JSON API media type as a json content view
This commit is contained in:
commit
605a4fd2fd
|
@ -226,7 +226,10 @@ class ViewXML(View):
|
|||
class ViewJSON(View):
|
||||
name = "JSON"
|
||||
prompt = ("json", "s")
|
||||
content_types = ["application/json"]
|
||||
content_types = [
|
||||
"application/json",
|
||||
"application/vnd.api+json"
|
||||
]
|
||||
|
||||
def __call__(self, data, **metadata):
|
||||
pj = pretty_json(data)
|
||||
|
|
|
@ -201,6 +201,13 @@ Larry
|
|||
)
|
||||
assert "Raw" in r[0]
|
||||
|
||||
r = cv.get_content_view(
|
||||
cv.get("Auto"),
|
||||
b"[1, 2, 3]",
|
||||
headers=Headers(content_type="application/vnd.api+json")
|
||||
)
|
||||
assert r[0] == "JSON"
|
||||
|
||||
tutils.raises(
|
||||
ContentViewException,
|
||||
cv.get_content_view,
|
||||
|
|
Loading…
Reference in New Issue