File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -149,7 +149,6 @@ export default class SsoSettingsComponent extends Component<SsoSettingsSignature
149
149
150
150
await this . ajax . post ( url , {
151
151
data : idpFormData ,
152
- contentType : 'multipart/form-data' ,
153
152
} ) ;
154
153
155
154
this . idpMetadataXml = null ;
Original file line number Diff line number Diff line change @@ -265,7 +265,12 @@ export default class IreneAjaxService extends Service {
265
265
// Only include headers if _shouldSendHeaders returns true
266
266
const headers = this . _shouldSendHeaders ( finalUrl , options . host )
267
267
? {
268
- 'Content-Type' : options . contentType || 'application/json' ,
268
+ // For data transfer objects we allow the browser set the content type of the request
269
+ ...( [ FormData , Blob ] . some (
270
+ ( dataType ) => options . data instanceof dataType
271
+ )
272
+ ? { }
273
+ : { 'Content-Type' : options . contentType || 'application/json' } ) ,
269
274
...this . defaultHeaders ,
270
275
...options . headers ,
271
276
}
@@ -327,11 +332,13 @@ export default class IreneAjaxService extends Service {
327
332
* @param {Response } response - The fetch response to parse.
328
333
* @returns {Promise<any | string> } - The parsed JSON or raw text.
329
334
*/
330
- private async parseResponseText < T > ( response : Response ) : Promise < T | string > {
335
+ private async parseResponseText < T extends object > (
336
+ response : Response
337
+ ) : Promise < T | string > {
331
338
const text = await response . text ( ) ;
332
339
333
340
try {
334
- return text ? JSON . parse ( text ) : { } ;
341
+ return text ? JSON . parse ( text ) : ( { } as T ) ;
335
342
} catch {
336
343
return text ;
337
344
}
You can’t perform that action at this time.
0 commit comments