I have inherited a controller. When a post request is made, with a well structured JSON document everything is fine.
When the JSON contains a space in a feld, 404 is returned. However, when the same request is made from mozilla restclient extension everything works.
The CURL request specifically is:
curl --include \
--request POST \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data-binary "{
"planCode" : "My Test App-standard"
}" \
"https://localhost/signupApi/v2/signup"
URLMapping:
"/signupApi/v2/$action"{
parseRequest = true // parse json, and assign to params
controller = "signupApiSignup"
}
So, why would a space in curl cause problems in the request body that grails receives?
Thanks
You are not quoting your strings there properly in your shell. Use '
for your parameters, if you plan to use "sensitive" chars like "
there. Or use \"
inside. Also curl can read a filename if you prefix it with @
instead of the actual data.
Yet in this case maybe quoting with '
is easiest. E.g.:
...
--data-binary '{
"planCode" : "My Test App-standard"
}'
...