Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tenfold/http-client

Package Overview
Dependencies
Maintainers
34
Versions
97
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tenfold/http-client

Http Client for Tenfold projects

  • 1.0.0-alpha.92
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
26
decreased by-40.91%
Maintainers
34
Weekly downloads
 
Created
Source

Tenfold HTTP Client

This repo exports helper functions to help capture metrics for API requests.

Usage

import { getHttpClient, HttpClientOptions, TfHttpClient } from '@tenfold/http-client';

const opts: HttpClientOptions = { statsdConfig: ... }
const httpClient: TfHttpClient = getHttpClient(opts);

httpClient.post(...)

The HttpClientOptions interface for now only has one property: statsdConfig, which represents the configuration object for statsd. See the resources below for statsd docs.

Using the Tenfold Error Interceptor

On version v0.5.0 an error interceptor helper was added. The interceptor will handle Axios errors and convert them to Tenfold Api error format (see https://github.com/tenfold/tenfold-api-responses-ts). To use it, you need to:

import { getHttpClient, TfHttpClient, TfErrorHandler } from '@tenfold/http-client';

const httpClient: TfHttpClient = getHttpClient(opts);

httpClient.interceptors.response.use((response: AxiosResponse) => response, TfErrorHandler.createInterceptor(logger));

Where logger is an optional parameter to log errors.

Developing

  1. Clone the repo git clone git@github.com:tenfold/libraries
  2. cd ./libraries
  3. yarn install

The source files can be found on the packages/http-client/src folder and the tests can be found on the test folder. Make sure to add tests for all your changes. Also, make sure to create a branch from master to develop your changes. To run the tests you can simply use the command yarn test. Once you're done with your changes, send a pull request to master and get reviews.

Generating a tag

See instructions here

Keywords

FAQs

Package last updated on 30 May 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc