docker_api_test.go 852 B

12345678910111213141516171819202122232425
  1. package main
  2. import (
  3. "net/http"
  4. "github.com/go-check/check"
  5. )
  6. func (s *DockerSuite) TestApiOptionsRoute(c *check.C) {
  7. status, _, err := sockRequest("OPTIONS", "/", nil)
  8. c.Assert(status, check.Equals, http.StatusOK)
  9. c.Assert(err, check.IsNil)
  10. }
  11. func (s *DockerSuite) TestApiGetEnabledCors(c *check.C) {
  12. res, body, err := sockRequestRaw("GET", "/version", nil, "")
  13. body.Close()
  14. c.Assert(err, check.IsNil)
  15. c.Assert(res.StatusCode, check.Equals, http.StatusOK)
  16. // TODO: @runcom incomplete tests, why old integration tests had this headers
  17. // and here none of the headers below are in the response?
  18. //c.Log(res.Header)
  19. //c.Assert(res.Header.Get("Access-Control-Allow-Origin"), check.Equals, "*")
  20. //c.Assert(res.Header.Get("Access-Control-Allow-Headers"), check.Equals, "Origin, X-Requested-With, Content-Type, Accept, X-Registry-Auth")
  21. }