CURL Command-Error code: 6 Couldn't resolve host when sending PUT request in DevTest External Command step in VS
search cancel

CURL Command-Error code: 6 Couldn't resolve host when sending PUT request in DevTest External Command step in VS

book

Article ID: 420730

calendar_today

Updated On:

Products

Service Virtualization

Issue/Introduction

Getting Curl Error code 6  when making a PUT request in Execute External command Step - using Curl command as below within a VSM. 
curl: (6) Could not resolve host: application
curl: (6) Could not resolve host: "https

curl -k -w %{response_code} --location --request PUT http://localhost:46766/v2/pet --cert \path\certfile.p12:passcode --cert-type P12  --header Accept-Language:en-US --header Content-Type:application/json  --header Accept:application/json  --data-raw '{\"userName\": \"***\",\"nn\":\"xxxx\",\"givenName\": \"xxxx\",\"mail\": \"uxxxx@***.com\",\"telephoneNumber\": \"09876543\",\"password\": \"******\"}' 

Environment

DevTest 10.8.0 or newer

Cause

 Curl is unable to translate the hostname and headers due to extra whitespaces and escape characters in JSON request body for --data-raw parameter. 

Resolution

Removing escape characters and spaces in JSON request in the CURL command --data-raw parameter gave valid response.


curl -k -w %{response_code} --location --request PUT http://localhost:46766/v2/pet --cert \path\certfile.p12:passcode --cert-type P12  --header Accept-Language:en-US --header Content-Type:application/json --header Accept:application/json --data-raw '{"userName": "***","nn": "xxxx","givenName": "xxxx","mail": "uxxxx@***.com","telephoneNumber": "09876543","password": "******"}' 

Additional Information

Running VS in Workstation ITR, the below command works with escape characters and spaces in JSON request 


curl -k -w %{response_code} --location --request PUT http://localhost:46766/v2/pet --cert \path\certfile.p12:passcode --cert-type P12 --header Accept-Language:en-US --header Content-Type:application/json  --header  Accept:application/json  --data-raw '{\"userName\": \"***\",\"nn\": \"xxxx\",\"givenName\": \"xxxx\",\"mail\": \"uxxxx@***.com\",\"telephoneNumber\": \"09876543\",\"password\": \"******\"}'