Support of --method, --body-data and --body-file#6
Support of --method, --body-data and --body-file#6stokito wants to merge 3 commits intoopenwrt:masterfrom
Conversation
The var means that ether --post-data or --post-file was set. Remove duplicated code to set the Content-Type header. Signed-off-by: Sergey Ponomarev <stokito@gmail.com>
In GNU wget the --spider first issues a HEAD request, then if HEAD fails, issues a GET request. In uclient, only a GET request is sent. The patch changes GET to HEAD e.g. get the file size without downloading it first. This is still not totally compatible with GNU wget because it does not retry with GET if HEAD fails. Someone may use the --spider to call a GET only API, so they may be affected. But this is incorrect usage while others may expect that the spider uses HEAD and don't expect a download. Signed-off-by: Sungbo Eo <mans0n@gorani.run> Signed-off-by: Sergey Ponomarev <stokito@gmail.com>
The --method allows executing PUT, DELETE, OPTIONS, HEAD e.g.:
wget -O - -q \
--method=PUT \
--body-data='{"id": 42}' \
--header='Content-Type: application/json' \
http://api.example.com/
To avoid clashes with the --post-data/file options,
the separate --body-data/file must be used.
They are stored to the same post_data and post_data vars.
Mutual usage of the options is not allowed, same as in GNU wget.
Signed-off-by: Sergey Ponomarev <stokito@gmail.com>
|
Looks good to me! I like how it cleans up the Content-Type header logic. I noticed that |
|
Thank you, Old patch from 2020 https://patchwork.ozlabs.org/project/openwrt/patch/CADR0UcUXJS4DkSSR_0-ZKhdEOaOwUn09WpJDpG9NMRYNsjQ8Sw@mail.gmail.com/ |
|
friendly remind on this |
|
Yes, I think it would be nice to have this and give the small flash devices some capabilities normally solved by installing the 400k, 10x-bigger @dangowrt Got any bandwidth for this? |
|
@dangowrt could you please merge the PR? |
|
Dear @nbd168 maybe you'll have a minute to review and merge the PR? |
The PR allows to set a custom method e.g. PUT, DELETE but only that supported by the
request_typeenum.This opens a way to use most of modern REST APIs:
You may send a body:
@dhewg @dangowrt @mans0n @efahl @ynezz please review