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:
Matt Martz 2018-05-31 11:43:00 -05:00 committed by GitHub
parent 0fd7d7500a
commit 961484e00d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 137 additions and 3 deletions

View file

@ -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