NeilMadden / apisecurityinaction

Source code that accompanies the book API Security in Action
MIT License
147 stars 97 forks source link

Getting Bad Message 400 - Chapter 3 #16

Open santikris2003 opened 2 years ago

santikris2003 commented 2 years ago

From Chapter 3 when I execute this getting Bad Message 400 , what Im missing here ?

curl -k --cacert "$(./mkcert -CAROOT)/rootCA.pem" -d ‘{"username":"demo","password":"password"}’ -H ‘Content-Type:application/json’ https://localhost:4567/users

curl: (3) URL using bad/illegal format or missing URL

Bad Message 400

reason: Illegal character OTEXT=0xe2
santikris2003 commented 2 years ago

I have employed all the files from Chap3 -end and starting the server , running the above curl command

NeilMadden commented 2 years ago

It's hard to know exactly what is going wrong here, but as a guess it looks like the single quotes around parts of the command have been replaced with "smart quotes", which might be causing an issue. Try copy and pasting the following:

curl -k --cacert "$(./mkcert -CAROOT)/rootCA.pem" -d '{"username":"demo","password":"password"}' -H 'Content-Type:application/json' https://localhost:4567/users