THRIFT-3851 Golang thrift continually adds the x/thrift content type
Client: Go
Patch: Connor Gorman <cgorman@medallia.com>
This closes #1026
diff --git a/lib/go/thrift/http_client.go b/lib/go/thrift/http_client.go
index 45720c9..88eb2c1 100644
--- a/lib/go/thrift/http_client.go
+++ b/lib/go/thrift/http_client.go
@@ -103,7 +103,8 @@
if client == nil {
client = DefaultHttpClient
}
- return &THttpClient{client: client, response: response, url: parsedURL}, nil
+ httpHeader := map[string][]string{"Content-Type": []string{"application/x-thrift"}}
+ return &THttpClient{client: client, response: response, url: parsedURL, header: httpHeader}, nil
}
func NewTHttpClient(urlstr string) (TTransport, error) {
@@ -120,7 +121,8 @@
if client == nil {
client = DefaultHttpClient
}
- return &THttpClient{client: client, url: parsedURL, requestBuffer: bytes.NewBuffer(buf), header: http.Header{}}, nil
+ httpHeader := map[string][]string{"Content-Type": []string{"application/x-thrift"}}
+ return &THttpClient{client: client, url: parsedURL, requestBuffer: bytes.NewBuffer(buf), header: httpHeader}, nil
}
func NewTHttpPostClient(urlstr string) (TTransport, error) {
@@ -227,7 +229,6 @@
if err != nil {
return NewTTransportExceptionFromError(err)
}
- p.header.Add("Content-Type", "application/x-thrift")
req.Header = p.header
response, err := p.client.Do(req)
if err != nil {