Ansible URI Module with multipart/mixed? Ansible URI Module with multipart/mixed? curl curl

Ansible URI Module with multipart/mixed?


Your request actually seems contradictory, as pointed by the cURL documentation:

-F, --form <name=content>

(HTTP SMTP IMAP) For HTTP protocol family, this lets curl emulate a filled-in form in which a user has pressed the submit button. This causes curl to POST data using the Content-Type multipart/form-data according to RFC 2388.

Source: https://curl.se/docs/manpage.html#-F, emphasis mine

So I guess you don't really end up with a Content-Type: multipart/mixed.

So from what it seems here is what you are looking at:

- uri:    url: http://example.org    ## -X POST    method: POST         ## -H "Auth: blahblahblah"                                      url_username: some_user    url_password: some_password    ## You might also need this one    # force_basic_auth: true    ## Content-type as forced by cURL when using -F    body_format: form-multipart    body:      ## -F "request_payload=@pay_file.xml"      request_payload:         content: "{{ lookup('file', 'pay_file.xml') }}"        filename: pay_file.xml        mime_type: application/xml      ## -F "workbook=@file.twb"      workbook:         content: "{{ lookup('file', 'file.twb') }}"        filename: file.twb        mime_type: application/twb

Also see: