|
|
@ -35,6 +35,7 @@ export async function httpCall< |
|
|
|
url: string, |
|
|
|
url: string, |
|
|
|
options?: HttpOptionsType, |
|
|
|
options?: HttpOptionsType, |
|
|
|
): Promise<ApiReturn<ResponseType, ErrorType>> { |
|
|
|
): Promise<ApiReturn<ResponseType, ErrorType>> { |
|
|
|
|
|
|
|
let statusCode: number = 0; |
|
|
|
try { |
|
|
|
try { |
|
|
|
const fingerprintPromise = await fp.load(); |
|
|
|
const fingerprintPromise = await fp.load(); |
|
|
|
const fingerprint = await fingerprintPromise.get(); |
|
|
|
const fingerprint = await fingerprintPromise.get(); |
|
|
@ -50,6 +51,7 @@ export async function httpCall< |
|
|
|
...(options?.headers ?? {}), |
|
|
|
...(options?.headers ?? {}), |
|
|
|
}), |
|
|
|
}), |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
statusCode = response.status; |
|
|
|
|
|
|
|
|
|
|
|
// @ts-ignore
|
|
|
|
// @ts-ignore
|
|
|
|
const doesAcceptHtml = options?.headers?.['Accept'] === 'text/html'; |
|
|
|
const doesAcceptHtml = options?.headers?.['Accept'] === 'text/html'; |
|
|
@ -83,7 +85,7 @@ export async function httpCall< |
|
|
|
return { |
|
|
|
return { |
|
|
|
response: undefined, |
|
|
|
response: undefined, |
|
|
|
error: { |
|
|
|
error: { |
|
|
|
status: 0, |
|
|
|
status: statusCode, |
|
|
|
message: error.message, |
|
|
|
message: error.message, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}; |
|
|
|
}; |
|
|
|