-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support multipart/form-data #9
Comments
Good question! In theory yes, if curl supports it then the plugin should support it. It would look something like this: POST http://httpbin.org/post HTTP/1.1
Host: httpbin.org
Content-Type: multipart/form-data;boundary="boundary"
Content-Length: 174
--boundary
Content-Disposition: form-data; name="field1"
value1
--boundary
Content-Disposition: form-data; name="field2"; filename="example.txt"
value2
--boundary--
HTTP/1.1 200 OK
Date: Mon, 24 May 2021 11:51:12 GMT
Content-Type: application/json
Content-Length: 463
Connection: keep-alive
Server: gunicorn/19.9.0
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
{
"args": {},
"data": "",
"files": {
"field2": "value2"
},
"form": {
"field1": "value1"
},
"headers": {
"Accept": "*/*",
"Content-Length": "174",
"Content-Type": "multipart/form-data;boundary=boundary",
"Host": "httpbin.org",
"User-Agent": "curl/7.68.0",
"X-Amzn-Trace-Id": "Root=1-60ab9330-6da5fc59153f7d211345873c"
},
"json": null,
"origin": "79.173.133.167",
"url": "http://httpbin.org/post"
} Some boundary defining helper methods might be helpful. |
@nicwest is it possible to include files in the form using vim-http? |
@sebiwi at the moment it would only work if you copy the body of the text over into a boundary similar to the above example. If someone can come up with a sensible way in-lining files I'm more than happy to merge that. |
Does this plugin only accept JSON requests? This was not clear in docs, and I also wasn't able to do form-data requests.
The text was updated successfully, but these errors were encountered: