URI Module find json sub type (#80745)
* uri: fixed search for json types to include strings in the format xxx/yyy+json
This commit is contained in:
2
changelogs/fragments/update-maybe-json-uri.yml
Normal file
2
changelogs/fragments/update-maybe-json-uri.yml
Normal file
@ -0,0 +1,2 @@
|
||||
bugfixes:
|
||||
- uri - fix search for JSON type to include complex strings containing '+'
|
||||
@ -707,7 +707,15 @@ def main():
|
||||
sub_type = 'octet-stream'
|
||||
content_encoding = 'utf-8'
|
||||
|
||||
maybe_json = content_type and sub_type.lower() in JSON_CANDIDATES
|
||||
if sub_type and '+' in sub_type:
|
||||
# https://www.rfc-editor.org/rfc/rfc6839#section-3.1
|
||||
sub_type_suffix = sub_type.partition('+')[2]
|
||||
maybe_json = content_type and sub_type_suffix.lower() in JSON_CANDIDATES
|
||||
elif sub_type:
|
||||
maybe_json = content_type and sub_type.lower() in JSON_CANDIDATES
|
||||
else:
|
||||
maybe_json = False
|
||||
|
||||
maybe_output = maybe_json or return_content or info['status'] not in status_code
|
||||
|
||||
if maybe_output:
|
||||
|
||||
@ -696,6 +696,18 @@
|
||||
that:
|
||||
- result.json.json[0] == 'JSON Test Pattern pass1'
|
||||
|
||||
- name: Test find JSON as subtype
|
||||
uri:
|
||||
url: "https://{{ httpbin_host }}/response-headers?content-type=application/ld%2Bjson"
|
||||
method: POST
|
||||
return_content: true
|
||||
register: result
|
||||
|
||||
- name: Validate JSON as subtype
|
||||
assert:
|
||||
that:
|
||||
- result.json is defined
|
||||
|
||||
- name: Make request that includes password in JSON keys
|
||||
uri:
|
||||
url: "https://{{ httpbin_host}}/get?key-password=value-password"
|
||||
|
||||
Reference in New Issue
Block a user