mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-30 03:14:22 +00:00
Detect JSON API media type as a json content view
IANA assignment here: https://www.iana.org/assignments/media-types/application/vnd.api+json More about JSON API: https://github.com/json-api/json-api
This commit is contained in:
parent
9c873d63f4
commit
275cf7a6c2
@ -226,7 +226,10 @@ class ViewXML(View):
|
|||||||
class ViewJSON(View):
|
class ViewJSON(View):
|
||||||
name = "JSON"
|
name = "JSON"
|
||||||
prompt = ("json", "s")
|
prompt = ("json", "s")
|
||||||
content_types = ["application/json"]
|
content_types = [
|
||||||
|
"application/json",
|
||||||
|
"application/vnd.api+json"
|
||||||
|
]
|
||||||
|
|
||||||
def __call__(self, data, **metadata):
|
def __call__(self, data, **metadata):
|
||||||
pj = pretty_json(data)
|
pj = pretty_json(data)
|
||||||
|
@ -201,6 +201,13 @@ Larry
|
|||||||
)
|
)
|
||||||
assert "Raw" in r[0]
|
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(
|
tutils.raises(
|
||||||
ContentViewException,
|
ContentViewException,
|
||||||
cv.get_content_view,
|
cv.get_content_view,
|
||||||
|
Loading…
Reference in New Issue
Block a user