1.2.0 • Published 9 months ago

ton-interceptor v1.2.0

Weekly downloads
-
License
ISC
Repository
github
Last release
9 months ago

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
1.2.0

9 months ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago