Код: Выделить всё
import { HTTPResponse } from "raw-http-parser";
const result = response.data;
const responseBuffer = Buffer.from(result, "utf8");
const { body: rawHttpBody } = HTTPResponse.fromPacket(responseBuffer);
try {
const body = JSON.parse(rawHttpBody) as Library;
return body;
} catch (err) {
throw new Error("Failed to get library from monitor even with a 200 status");
}
Ответ имеет тип
Код: Выделить всё
export interface AxiosResponse {
data: T;
status: number;
statusText: string;
headers: AxiosResponseHeaders;
config: AxiosRequestConfig;
request?: any;
}
Подробнее здесь: https://stackoverflow.com/questions/797 ... ponse-data
Мобильная версия