There is a file named countries.go It imports package github.com/ant0ine/go-json-rest/rest.
referred code from
https://gowalker.org/github.com/ant0ine/go-json-rest#countries
Countries section:Demo of POST DELETE etc
When i try to use command curl -i -d '{"Code":"FR","Name":"France"}' http_URL
It gives
{ "Error": "invalid character '\\'' looking for beginning of value" }
I have used the package given above .It seems the method in the request.go given as DecodeJsonPayload() ,which implements unmarshal() for JSON , have internal server error.
I am unable to correct that.Help appreciated
I managed to duplicate your problem with curl on Windows.
Use the following curl command instead:
curl -i -d "{\"Code\":\"FR\",\"Name\":\"France\"}" http_URL
A related SO question: How to send double quote in -d parameter for curl.exe?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.