@@ -18,7 +18,7 @@ type bodyEncoder interface {
18
18
type bulkBodyEncoder interface {
19
19
bulkWriter
20
20
21
- AddHeader (* http.Header )
21
+ AddHeader (* http.Header , string )
22
22
Reset ()
23
23
}
24
24
@@ -56,8 +56,12 @@ func (b *jsonEncoder) Reset() {
56
56
b .buf .Reset ()
57
57
}
58
58
59
- func (b * jsonEncoder ) AddHeader (header * http.Header ) {
60
- header .Add ("Content-Type" , "application/json; charset=UTF-8" )
59
+ func (b * jsonEncoder ) AddHeader (header * http.Header , contentType string ) {
60
+ if (contentType == "" ) {
61
+ header .Add ("Content-Type" , "application/json; charset=UTF-8" )
62
+ } else {
63
+ header .Add ("Content-Type" , contentType )
64
+ }
61
65
}
62
66
63
67
func (b * jsonEncoder ) Reader () io.Reader {
@@ -101,8 +105,12 @@ func (b *jsonLinesEncoder) Reset() {
101
105
b .buf .Reset ()
102
106
}
103
107
104
- func (b * jsonLinesEncoder ) AddHeader (header * http.Header ) {
105
- header .Add ("Content-Type" , "application/x-ndjson; charset=UTF-8" )
108
+ func (b * jsonLinesEncoder ) AddHeader (header * http.Header , contentType string ) {
109
+ if (contentType == "" ) {
110
+ header .Add ("Content-Type" , "application/x-ndjson; charset=UTF-8" )
111
+ } else {
112
+ header .Add ("Content-Type" , contentType )
113
+ }
106
114
}
107
115
108
116
func (b * jsonLinesEncoder ) Reader () io.Reader {
@@ -169,8 +177,12 @@ func (b *gzipEncoder) Reader() io.Reader {
169
177
return b .buf
170
178
}
171
179
172
- func (b * gzipEncoder ) AddHeader (header * http.Header ) {
173
- header .Add ("Content-Type" , "application/json; charset=UTF-8" )
180
+ func (b * gzipEncoder ) AddHeader (header * http.Header , contentType string ) {
181
+ if (contentType == "" ) {
182
+ header .Add ("Content-Type" , "application/json; charset=UTF-8" )
183
+ } else {
184
+ header .Add ("Content-Type" , contentType )
185
+ }
174
186
header .Add ("Content-Encoding" , "gzip" )
175
187
}
176
188
@@ -225,8 +237,12 @@ func (b *gzipLinesEncoder) Reader() io.Reader {
225
237
return b .buf
226
238
}
227
239
228
- func (b * gzipLinesEncoder ) AddHeader (header * http.Header ) {
229
- header .Add ("Content-Type" , "application/x-ndjson; charset=UTF-8" )
240
+ func (b * gzipLinesEncoder ) AddHeader (header * http.Header , contentType string ) {
241
+ if (contentType == "" ) {
242
+ header .Add ("Content-Type" , "application/x-ndjson; charset=UTF-8" )
243
+ } else {
244
+ header .Add ("Content-Type" , contentType )
245
+ }
230
246
header .Add ("Content-Encoding" , "gzip" )
231
247
}
232
248
0 commit comments