How about this answer? I think that there might be several solutions. So please think of this as one of them. In order to send the content of a.html
with multipart/form-data, the request body is required to be created and send it. As a example, this answer supposes as follows.
a.html
is <html><body>Inline!</body></html>
.
- You use curl on bash.
The request body is as follows.
--boundaryboundary
Content-Disposition: form-data; name="file"; filename="a.html"
Content-Type: text/html
<html><body>Inline!</body></html>
--boundaryboundary--
Replace the line break to \r\n
and send this.
--boundaryboundary\r\nContent-Disposition: form-data; name="file"; filename="a.html"\r\nContent-Type: text/html\r\n\r\n<html><body>Inline!</body></html>\r\n--boundaryboundary--
Modified curl sample :
The modified curl sample is as follows. Content-Type
is multipart/form-data; boundary=boundaryboundary
.
curl -X POST \
-H 'Content-Type: multipart/form-data; boundary=boundaryboundary' \
-d $'--boundaryboundary\r\nContent-Disposition: form-data; name="file"; filename="a.html"\r\nContent-Type: text/html\r\n\r\n<html><body>Inline!</body></html>\r\n--boundaryboundary--' \
'http://localhost:8080/convert'
Reference :
If this was not what you want, I'm sorry.