fix: return response status code (#5815)

pull/5817/head
Arik Chakma 11 months ago committed by GitHub
parent 1cc34e61c4
commit 4d7a0f5d06
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      src/lib/http.ts

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

Loading…
Cancel
Save