Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wget windows and multiple --header switches

I'm trying to use wget 1.11.4 running on Windows Server 2003 to do some JSON with a web site. I can retrieve info OK but I can't send any. I'm not positive that my JSON is formatted correctly but there seems to be a more fundamental problem.

If I do:

wget --header="Authorization: Bearer <redacted>" --no-check-certificate --post-data="{'workspaces':{'title':'CMC Regulatory Support','creator_role':'maven'}}"  https://api.mavenlink.com/api/v1/workspaces.json

I get a JSON error back from the site "ERROR 422: Unprocessable Entity." But if I add another --header:

wget -S --header="Authorization: Bearer <redacted>" -–header="Content-Type: application/json" --no-check-certificate --post-data="{'workspaces':{'title':'CMC Regulatory Support','creator_role':'maven'}}"  https://api.mavenlink.com/api/v1/workspaces.json

I get:

SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
syswgetrc = C:\Program Files\GnuWin32/etc/wgetrc
wget: invalid option -- û
Usage: wget [OPTION]... [URL]...

Try `wget --help' for more options.

but the manual clearly states that multiple --header switches are allowed, and I see that swithc used in examples on the web?. WTF?

like image 225
JonF Avatar asked Oct 21 '25 07:10

JonF


1 Answers

Your second --header parameter before the Content-Type contains different dashes.

-–header="Content-Type

If you fix it wget will send the request.

like image 92
wiktor Avatar answered Oct 23 '25 22:10

wiktor



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!