'curl: (6) Could not resolve host: POST; Unknown error
I have shell script to run from Jenkins. First step generates token. But when executed from Jenkins, it gives connection error
Jenkins here is Linux server
Command:
curl -w -X POST $URL -H Content-Type:application/x-www-form-urlencoded -H Content-Length:1045 -H Authorization:OAuth2 --data '{"grant_type":"password", "username":"User","password":"pwd"}' --write-out token
Error:
curl: (6) Could not resolve host: POST; Unknown error
100 88 0 0 0 88 0 0 --:--:-- 0:02:01 --:--:-- 0
100 88 0 0 0 88 0 0 --:--:-- 0:02:02 --:--:-- 0
100 88 0 0 0 88 0 0 --:--:-- 0:02:02 --:--:-- 0
curl: (56) Recv failure: Connection reset by peer
Build step 'Execute shell' marked build as failure
Solution 1:[1]
You failed to provide a value with -w.
This means that -X is taken that value instead of being a switch in its own right.
That means that POST is not taken as the value to the -X switch, so it is taken as the URL instead.
Remove -w or pass it a value.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Quentin |
