Escape colon in curl with -u option

I can't wrap my head around how to escape semicolon in username while making a GET request.

curl -u testclient:sdtest1:pass -XGET -H "Content-type:application/json" \

But the server says that credentials are invalid. How can I escape this?

1

1 Answer

How do I escape a special character in a username while making a GET request.

Find the hexidecimal value of the value to be escaped, and prefix it with %.

So in your case, use the following:

curl -u testclient%3A:sdtest1:pass ...

"Is there any way that I can specify a username containing a colon"

"user:name:password" => "user%3Aname:password"

Source Specifying colon in authentication username

0

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like