File tree 3 files changed +92
-90
lines changed
react-native/services/Request 3 files changed +92
-90
lines changed Original file line number Diff line number Diff line change @@ -35,7 +35,8 @@ export class Request implements RequestInterface {
35
35
constructor (
36
36
baseUrl : string ,
37
37
private readonly timeoutMilliseconds : number ,
38
- private readonly authorizationHeaderFactory : ( ) => null | string
38
+ private readonly authorizationHeaderFactory : ( ) => null | string ,
39
+ private readonly fetch : GlobalFetch [ 'fetch' ]
39
40
) {
40
41
if ( ! / ^ [ a - z ] + : \/ \/ / . test ( baseUrl ) ) {
41
42
baseUrl = `https://${ baseUrl } `
@@ -180,7 +181,7 @@ export class Request implements RequestInterface {
180
181
switch ( requestBody . type ) {
181
182
case 'empty' :
182
183
case 'json' :
183
- response = await fetch ( url , {
184
+ response = await this . fetch ( url , {
184
185
signal,
185
186
method,
186
187
headers : {
@@ -250,7 +251,7 @@ export class Request implements RequestInterface {
250
251
return await this . withTimeout ( abortSignal , async ( signal ) => {
251
252
const url = this . constructUrl ( route , queryParameters )
252
253
253
- const response = await fetch ( url , {
254
+ const response = await this . fetch ( url , {
254
255
signal,
255
256
method,
256
257
headers : {
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ const request = new Request(
12
12
30000 ,
13
13
() => ` BEARER your-authorization-header ` ,
14
14
[" 200" ],
15
+ fetch
15
16
);
16
17
17
18
await request .withoutResponse (
You can’t perform that action at this time.
0 commit comments