diff options
author | Matt Martz <matt@sivel.net> | 2022-07-13 11:06:52 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-13 11:06:52 -0500 |
commit | d58e69c82d7edd0583dd8e78d76b075c33c3151e (patch) | |
tree | 0a5c5a9d61733b8ff54e5a5f3ad6e53374b7209b /test/integration | |
parent | a6e671db25381ed111bbad0ab3e7d97366395d05 (diff) | |
download | ansible-d58e69c82d7edd0583dd8e78d76b075c33c3151e.tar.gz |
Add support for gzip decoding responses (#41925)
Diffstat (limited to 'test/integration')
-rw-r--r-- | test/integration/targets/get_url/tasks/main.yml | 30 | ||||
-rw-r--r-- | test/integration/targets/uri/tasks/main.yml | 21 |
2 files changed, 51 insertions, 0 deletions
diff --git a/test/integration/targets/get_url/tasks/main.yml b/test/integration/targets/get_url/tasks/main.yml index cf2ffacdd6..b804221168 100644 --- a/test/integration/targets/get_url/tasks/main.yml +++ b/test/integration/targets/get_url/tasks/main.yml @@ -579,6 +579,36 @@ - (result.content | b64decode | from_json).headers.get('Foo') == 'bar' - (result.content | b64decode | from_json).headers.get('Baz') == 'qux' +- name: Test gzip decompression + get_url: + url: https://{{ httpbin_host }}/gzip + dest: "{{ remote_tmp_dir }}/gzip.json" + +- name: Get gzip file contents + slurp: + path: "{{ remote_tmp_dir }}/gzip.json" + register: gzip_json + +- name: validate gzip decompression + assert: + that: + - (gzip_json.content|b64decode|from_json).gzipped + +- name: Test gzip no decompression + get_url: + url: https://{{ httpbin_host }}/gzip + dest: "{{ remote_tmp_dir }}/gzip.json.gz" + decompress: no + +- name: Get gzip file contents + command: 'gunzip -c {{ remote_tmp_dir }}/gzip.json.gz' + register: gzip_json + +- name: validate gzip no decompression + assert: + that: + - (gzip_json.stdout|from_json).gzipped + - name: Test client cert auth, with certs get_url: url: "https://ansible.http.tests/ssl_client_verify" diff --git a/test/integration/targets/uri/tasks/main.yml b/test/integration/targets/uri/tasks/main.yml index 0da1c83c79..8f9c41ad24 100644 --- a/test/integration/targets/uri/tasks/main.yml +++ b/test/integration/targets/uri/tasks/main.yml @@ -699,6 +699,27 @@ that: - sanitize_keys.json.args['key-********'] == 'value-********' +- name: Test gzip encoding + uri: + url: "https://{{ httpbin_host }}/gzip" + register: result + +- name: Validate gzip decoding + assert: + that: + - result.json.gzipped + +- name: test gzip encoding no auto decompress + uri: + url: "https://{{ httpbin_host }}/gzip" + decompress: false + register: result + +- name: Assert gzip wasn't decompressed + assert: + that: + - result.json is undefined + - name: Create a testing file copy: content: "content" |