ant0ine / go-json-rest

A quick and easy way to setup a RESTful JSON API
https://ant0ine.github.io/go-json-rest/
MIT License
3.51k stars 381 forks source link

add another curl request for comparison #223

Open tsukune-ch opened 6 years ago

tsukune-ch commented 6 years ago

The current CORS curl demo will not return a response containing CORS headers. I think it would be better to add a curl demo that returns a response containing that.

$ curl -i http://127.0.0.1:8080/countries
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
X-Powered-By: go-json-rest
Date: Mon, 04 Dec 2017 18:18:01 GMT
Content-Length: 105

[
  {
    "Code": "FR",
    "Name": "France"
  },
  {
    "Code": "US",
    "Name": "United States"
  }
]
$ curl -H "Origin: http://my.other.host" -i http://127.0.0.1:8080/countries
HTTP/1.1 200 OK
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: http://my.other.host
Content-Type: application/json; charset=utf-8
X-Powered-By: go-json-rest
Date: Mon, 04 Dec 2017 18:18:21 GMT
Content-Length: 105

[
  {
    "Code": "FR",
    "Name": "France"
  },
  {
    "Code": "US",
    "Name": "United States"
  }
]