Ele intercepta o coração dos devs, sem nunca dar timeout
npm install ton-interceptorEssa lib intercepta requisições acrescentando duration e gerando logs úteis para monitoramento.
``shell`
npm install ton-interceptor
No typescript:
`typescript`
import { axiosFactory, AxiosResponseWithMetadata } from "ton-interceptor";
const axios = axiosFactory(logger, {
timeout: 50000,
httpsAgent: new https.Agent({
keepAlive: true,
rejectUnauthorized: false,
}),
});
const response = await axios.request<
{},
AxiosResponseWithMetadata
>(options);
No node:
`javascript`
const { axiosFactory } = require("ton-interceptor");
const axios = axiosFactory(logger, {
timeout: 50000,
httpsAgent: new https.Agent({
keepAlive: true,
rejectUnauthorized: false,
}),
});
const response = await axios.get("url", { headers: {} });
Se timeout e httpsAgent não forem passados serão usados timeout 30000, keepAlive true e rejectUnauthorized false.
Instalar dependências
`shell`
npm install
Testes unitários
`shell`
npm run test
npm run test:coverage
Lint
`shell`
npm run lint
Build
`shell``
npm run build