diff options
Diffstat (limited to 'vendor/gopkg.in/olivere/elastic.v5/request_test.go')
-rw-r--r-- | vendor/gopkg.in/olivere/elastic.v5/request_test.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/vendor/gopkg.in/olivere/elastic.v5/request_test.go b/vendor/gopkg.in/olivere/elastic.v5/request_test.go index 2a2d229df..d5ae4f800 100644 --- a/vendor/gopkg.in/olivere/elastic.v5/request_test.go +++ b/vendor/gopkg.in/olivere/elastic.v5/request_test.go @@ -8,6 +8,20 @@ import "testing" var testReq *Request // used as a temporary variable to avoid compiler optimizations in tests/benchmarks +func TestRequestSetContentType(t *testing.T) { + req, err := NewRequest("GET", "/") + if err != nil { + t.Fatal(err) + } + if want, have := "application/json", req.Header.Get("Content-Type"); want != have { + t.Fatalf("want %q, have %q", want, have) + } + req.Header.Set("Content-Type", "application/x-ndjson") + if want, have := "application/x-ndjson", req.Header.Get("Content-Type"); want != have { + t.Fatalf("want %q, have %q", want, have) + } +} + func BenchmarkRequestSetBodyString(b *testing.B) { req, err := NewRequest("GET", "/") if err != nil { |