@@ -173,21 +173,29 @@ func (c *Client) SetApiBaseURL(urlStr url.URL) {
173
173
}
174
174
175
175
func (c * Client ) executeRaw (method string , urlStr string , text string ) (io.ReadCloser , error ) {
176
+ return c .executeRawContentType (method , urlStr , text , "application/json" )
177
+ }
178
+
179
+ func (c * Client ) executeRawContentType (method , urlStr , text , contentType string ) (io.ReadCloser , error ) {
176
180
body := strings .NewReader (text )
177
181
178
182
req , err := http .NewRequest (method , urlStr , body )
179
183
if err != nil {
180
184
return nil , err
181
185
}
182
186
if text != "" {
183
- req .Header .Set ("Content-Type" , "application/json" )
187
+ req .Header .Set ("Content-Type" , contentType )
184
188
}
185
189
186
190
c .authenticateRequest (req )
187
191
return c .doRawRequest (req , false )
188
192
}
189
193
190
194
func (c * Client ) execute (method string , urlStr string , text string ) (interface {}, error ) {
195
+ return c .executeContentType (method , urlStr , text , "application/json" )
196
+ }
197
+
198
+ func (c * Client ) executeContentType (method string , urlStr string , text string , contentType string ) (interface {}, error ) {
191
199
// Use pagination if changed from default value
192
200
const DEC_RADIX = 10
193
201
if strings .Contains (urlStr , "/repositories/" ) {
@@ -221,7 +229,7 @@ func (c *Client) execute(method string, urlStr string, text string) (interface{}
221
229
return nil , err
222
230
}
223
231
if text != "" {
224
- req .Header .Set ("Content-Type" , "application/json" )
232
+ req .Header .Set ("Content-Type" , contentType )
225
233
}
226
234
227
235
c .authenticateRequest (req )
0 commit comments