Looking at the analogous API in Python’s requests
module (which does take a dict), those values are encoded as content-type application/x-www-form-urlencoded
:
import requests
r=requests.post('http://localhost:8080/', data={'a':1, 'b': "doh"})
melis@juggle 09:37:~$ nc -l -p 8080
POST / HTTP/1.1
Host: localhost:8080
User-Agent: python-requests/2.26.0
Accept-Encoding: gzip, deflate, br
Accept: */*
Connection: keep-alive
Content-Length: 9
Content-Type: application/x-www-form-urlencoded
a=1&b=doh
So if you can do the same with HTTP.jl that should work. Here’s actually a post on this forum from some years ago, with exactly the same issue, but no answer :-(. There’s actually also a closed HTTP.jl issue to document exactly the thing you want here, but the docs were only updated for the case of POSTing JSON, although the issue does give a solution (see this comment):
headers = ["Content-Type" => "application/x-www-form-urlencoded"]
params = Dict("Password" => "password")
body = HTTP.URIs.escapeuri(params)
response = HTTP.post("http://localhost:8080", headers, body, verbose=2)
HTTP.Messages.Request:
"""
POST / HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Host: localhost:8080
Accept: */*
User-Agent: HTTP.jl/1.7.1
Content-Length: 17
Password=password"""
Edit: deleted reference to example that does not apply here