ton-interceptor
v1.2.0
Published
Ele intercepta o coração dos devs, sem nunca dar timeout
Downloads
444
Readme
Ton Interceptor
Essa lib intercepta requisições acrescentando duration e gerando logs úteis para monitoramento.
Instalação
npm install ton-interceptor
Como utilizar
No 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<BalanceOperation[]>
>(options);
No node:
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.
Para contribuir
Instalar dependências
npm install
Testes unitários
npm run test
npm run test:coverage
Lint
npm run lint
Build
npm run build