@@ -164,21 +164,29 @@ func (c *Client) SetApiBaseURL(urlStr string) {
164
164
}
165
165
166
166
func (c * Client ) executeRaw (method string , urlStr string , text string ) (io.ReadCloser , error ) {
167
+ return c .executeRawContentType (method , urlStr , text , "application/json" )
168
+ }
169
+
170
+ func (c * Client ) executeRawContentType (method , urlStr , text , contentType string ) (io.ReadCloser , error ) {
167
171
body := strings .NewReader (text )
168
172
169
173
req , err := http .NewRequest (method , urlStr , body )
170
174
if err != nil {
171
175
return nil , err
172
176
}
173
177
if text != "" {
174
- req .Header .Set ("Content-Type" , "application/json" )
178
+ req .Header .Set ("Content-Type" , contentType )
175
179
}
176
180
177
181
c .authenticateRequest (req )
178
182
return c .doRawRequest (req , false )
179
183
}
180
184
181
185
func (c * Client ) execute (method string , urlStr string , text string ) (interface {}, error ) {
186
+ return c .executeContentType (method , urlStr , text , "application/json" )
187
+ }
188
+
189
+ func (c * Client ) executeContentType (method string , urlStr string , text string , contentType string ) (interface {}, error ) {
182
190
// Use pagination if changed from default value
183
191
const DEC_RADIX = 10
184
192
if strings .Contains (urlStr , "/repositories/" ) {
@@ -212,7 +220,7 @@ func (c *Client) execute(method string, urlStr string, text string) (interface{}
212
220
return nil , err
213
221
}
214
222
if text != "" {
215
- req .Header .Set ("Content-Type" , "application/json" )
223
+ req .Header .Set ("Content-Type" , contentType )
216
224
}
217
225
218
226
c .authenticateRequest (req )
0 commit comments