ton-interceptor
TypeScript icon, indicating that this package has built-in type declarations

1.1.3 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i ton-interceptor

Weekly Downloads

40

Version

1.1.3

License

ISC

Unpacked Size

16.7 kB

Total Files

23

Last publish

Collaborators

  • stonemaistech