mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-16 18:05:27 -07:00
Add src parameter for uri module that can be used in place of body. Supports binary files (#33689)
* First pass at a src parameter that can be used in place of body. Supports binary files * Add test for uri src body * Bump version_added to 2.6 * Close the open file handle * Add uri action plugin that handles src/remote_src * Document remote_src * Remove duplicate info about remote_src * Bump version_added to 2.7
This commit is contained in:
parent
0fd7d7500a
commit
961484e00d
3 changed files with 137 additions and 3 deletions
|
@ -456,6 +456,35 @@
|
|||
environment:
|
||||
NETRC: "{{ output_dir|expanduser }}/netrc"
|
||||
|
||||
- name: Test JSON POST with src
|
||||
uri:
|
||||
url: "https://{{ httpbin_host}}/post"
|
||||
src: pass0.json
|
||||
method: POST
|
||||
return_content: true
|
||||
body_format: json
|
||||
register: result
|
||||
|
||||
- name: Validate POST with src works
|
||||
assert:
|
||||
that:
|
||||
- result.json.json[0] == 'JSON Test Pattern pass1'
|
||||
|
||||
- name: Test JSON POST with src and remote_src=True
|
||||
uri:
|
||||
url: "https://{{ httpbin_host}}/post"
|
||||
src: "{{ role_path }}/files/pass0.json"
|
||||
remote_src: true
|
||||
method: POST
|
||||
return_content: true
|
||||
body_format: json
|
||||
register: result
|
||||
|
||||
- name: Validate POST with src and remote_src=True works
|
||||
assert:
|
||||
that:
|
||||
- result.json.json[0] == 'JSON Test Pattern pass1'
|
||||
|
||||
- name: Test follow_redirects=none
|
||||
include_tasks: redirect-none.yml
|
||||
|
||||
|
@ -466,4 +495,4 @@
|
|||
include_tasks: redirect-urllib2.yml
|
||||
|
||||
- name: Test follow_redirects=all
|
||||
include_tasks: redirect-all.yml
|
||||
include_tasks: redirect-all.yml
|
Loading…
Add table
Add a link
Reference in a new issue