npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@fengcart/http

v1.17.0

Published

HTTP utilities

Downloads

17

Readme

@fengcart/http

HTTP client implementations with standardized request success/error logging.

Usage

yarn add @fengcart/http

Implementations

RequestClient (deprecated)

Our RequestClient implementation is deprecated since the underlying request package itself was deprecated. Use the axiosCreate function instead.

As of Feb 11th 2020, request is fully deprecated. No new changes are expected to land. In fact, none have landed for some time. This package is also deprecated because it depends on request.

https://github.com/request/request-promise#deprecated

AxiosClient (deprecated)

AxiosClient is a custom HTTP client built around the axios package. This implementation is deprecated in favor of the axiosCreate factory function.

The AxiosClient provides only a single method: request(config: AxiosRequestConfig).

const client: AxiosClient = new AxiosClient({ baseURL: 'https://www.bk.com', timeout: 1000 });

// GET https://www.bk.com/faq
const result = await client.request({
  method: 'GET',
  pathParams: { example: 'faq' }
  responseType: 'document',
  templatizedPath: '/:example',
});

axiosCreate

The axiosCreate function is a small wrapper around the standard axios.create factory function. This function returns a new axios instance with our standardized logging interceptors applied.

const client: AxiosInstance = axiosCreate({ baseURL: 'https://www.bk.com', timeout: 1000 });

// GET https://www.bk.com/faq
const result = await client.get('/faq', { responseType: 'document' });

HTTP request logging

HTTP requests made with @fengcart/http clients will log response outcome and relevant metadata. This logging is critically important for observability, and is also useful for quickly identifying vendor API service degredations.

HTTP requests that return a successful response will automatically log "HTTP_REQUEST_SUCCESS".

INFO	HTTP_REQUEST_SUCCESS
{
  "level": 30,
  "level_label": "info",
  "time": 1629991203772,
  "brand": "bk",
  "stage": "prod",
  "name": "sls-rbi-prod-bk-whitelabel-graphql",
  "awsRequestId": "example-aws-request-id",
  "apiRequestId": "example-api-request-id",
  "x-correlation-trace-id": "example-correlation-trace-id",
  "x-correlation-id": "example-correlation-id",
  "request": {
    "host": "www.bk.com",
    "method": "GET",
    "path": "/faq",
    "protocol": "https",
    "templatizedPath": "/:example"
  },
  "response": {
    "status": 200,
    "statusCategory": "2XX"
  },
  "retryCurrentAttempt": 1,
  "success": true,
  "uri": "https://www.bk.com/faq",
  "msg": "HTTP_REQUEST_SUCCESS"
}

HTTP requests that throw an error will automatically log "HTTP_REQUEST_ERROR".

WARN	HTTP_REQUEST_FAILURE
{
  "level": 40,
  "level_label": "warn",
  "time": 1629991646729,
  "brand": "bk",
  "stage": "qa",
  "name": "sls-rbi-prod-bk-whitelabel-graphql",
  "awsRequestId": "example-aws-request-id",
  "apiRequestId": "example-api-request-id",
  "x-correlation-trace-id": "example-correlation-trace-id",
  "x-correlation-id": "example-correlation-id",
  "metadata": {},
  "request": {
    "method": "GET",
    "templatizedPath": "/api/v2/menu-service/plus/:storeId",
    "host": "use1-prod-bk.rbictg.com",
    "path": "/api/v2/menu-service/plus/21011",
    "protocol": "https"
  },
  "response": {
    "body": {
      "error": "no PLUs data found for 21011"
    },
    "headers": {
      "content-type": "application/json",
      "content-length": "40",
      "connection": "close",
      "date": "Thu, 26 Aug 2021 15:27:26 GMT",
      "x-amzn-requestid": "exmaple-aws-request-id",
      "x-amz-apigw-id": "example-aws-apig-id",
      "x-amzn-trace-id": "example-aws-trace-id",
    },
    "status": 404,
    "statusCategory": "4XX"
  },
  "retryCurrentAttempt": 0,
  "success": false,
  "uri": "https://use1-prod-BK.rbictg.com/api/v2/menu-service/plus/21011",
  "msg": "HTTP_REQUEST_FAILURE"
}