@@ -63,7 +63,8 @@ export const request = async (
6363 data ?: FormData | object | undefined ,
6464 additionalHeaders : Record < string , string > = { } ,
6565 retryNumber = 0 ,
66- options : RequestOptions = { }
66+ options : RequestOptions = { } ,
67+ returnRaw = false
6768) : Promise < any > => {
6869 const body = data instanceof Array ? data && [ ...data ] : data && { ...data } ;
6970
@@ -119,13 +120,19 @@ export const request = async (
119120 data ,
120121 additionalHeaders ,
121122 retryNumber + 1 ,
122- options
123+ options ,
124+ returnRaw
123125 )
124126 ) ;
125127 } ) ;
126128 }
127129 }
128130
131+ if ( returnRaw ) {
132+ resolve ( response ) ;
133+ return response ;
134+ }
135+
129136 const imageTypes = [ "image/gif" , "image/jpeg" , "image/png" ] ;
130137 const { headers } = response ;
131138 const type = headers . get ( "Content-Type" ) ;
@@ -182,7 +189,8 @@ export const authenticatedRequest = async (
182189 data ?: FormData | object | undefined ,
183190 additionalHeaders : Record < string , string > = { } ,
184191 retryNumber = 0 ,
185- options : RequestOptions = { }
192+ options : RequestOptions = { } ,
193+ returnRaw = false
186194) : Promise < any > => {
187195 const token = await authenticationPromise ;
188196 if ( ! token ) {
@@ -208,14 +216,16 @@ export const authenticatedRequest = async (
208216 data ,
209217 additionalHeaders ,
210218 retryNumber + 1 ,
211- options
219+ options ,
220+ returnRaw
212221 )
213222 ) ;
214223 }
215224
216225 const authenticationHeaders = {
217226 Authorization : `Bearer ${ token . access_token } `
218227 } ;
228+
219229 return request (
220230 url ,
221231 method ,
@@ -225,7 +235,8 @@ export const authenticatedRequest = async (
225235 ...authenticationHeaders
226236 } ,
227237 retryNumber ,
228- options
238+ options ,
239+ returnRaw
229240 ) ;
230241} ;
231242
0 commit comments