[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to send a POST request by wget same to a httpie request?

From: Ander Juaristi
Subject: Re: How to send a POST request by wget same to a httpie request?
Date: Tue, 21 Jul 2020 17:27:03 +0200
User-agent: Roundcube Webmail

You can send POST requests, with --method=POST.

Multipart bodies are not, and will probably never be, supported in wget.

There is ongoing work to implementing them in wget2, however [0]. You might want to check it out.

Having said this, in wget you can send the contents of a file as a body with the --body-file option. This is not the same as a multipart body, but might fit your use case. What --body-file does is send the file's contents directly in the body of the HTTP request. There is also --post-file, which is basically --method=POST + --body-file.

- AJ

[0] https://gitlab.com/gnuwget/wget2

El 2020-07-02 00:32, Peng Yu escribió:
$ http --form POST localhost:9000 file@1.txt

The above httpie (https://httpie.org/) command will send the following
POST request. Could anybody let me know what is the equivalent wget
command to achieve the same HTTP request? Thanks.

Host: localhost:9000
User-Agent: HTTPie/2.2.0
Accept-Encoding: gzip, deflate
Accept: */*
Connection: keep-alive
Content-Length: 171
Content-Type: multipart/form-data; boundary=36922889709f11dcba960da4b9d51a2e

Content-Disposition: form-data; name="file"; filename="1.txt"
Content-Type: text/plain



reply via email to

[Prev in Thread] Current Thread [Next in Thread]