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 🙏

© 2024 – Pkg Stats / Ryan Hefner

ngx-correlation-id

v0.4.0

Published

Injects a correlation id into every outgoing http request

Downloads

7

Readme

Getting started

1. Import the module into your app.module.ts

  imports: [
    BrowserModule,
    HttpClientModule,
    NgxCorrelationIdModule
  ],

Tip: NgxCorrelationIdModule provide some customization to the underlying https://www.npmjs.com/package/simple-correlation-id package. See release note sections below for details

2. Make a http request

http.get('https://echook.azurewebsites.net/echo').subscribe();

3. Check the request header. There should be a x-correlation-id present

The https://echook.azurewebsites.net/echo API will echo back all HTTP headers sent to it. The response looks like below (notice the presence of x-correlation-id header)

{
  "method": "GET",
  "path": "/echo",
  "protocol": "HTTP/1.1",
  "headers": {
    "accept": "application/json, text/plain, */*",
    "host": "echook.azurewebsites.net",
    "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
    "accept-encoding": "gzip, deflate, br",
    "accept-language": "en-US,en;q=0.9,vi;q=0.8",
    "cache-control": "no-cache",
    "max-forwards": "10",
    "origin": "http://localhost:4200",
    "pragma": "no-cache",
    "referer": "http://localhost:4200/",
    "sec-ch-ua": "\"Google Chrome\";v=\"107\", \"Chromium\";v=\"107\", \"Not=A?Brand\";v=\"24\"",
    "x-correlation-id": "ui-1668851520625",
    "sec-ch-ua-mobile": "?0",
    "sec-ch-ua-platform": "\"Windows\"",
    "sec-fetch-site": "cross-site",
    "sec-fetch-mode": "cors",
    "sec-fetch-dest": "empty",
    "x-arr-log-id": "c44cef71-afe9-417f-b019-a1239d992165",
    "client-ip": "220.255.68.222:60496",
    "x-client-ip": "220.255.68.222",
    "disguised-host": "echook.azurewebsites.net",
    "x-site-deployment-id": "echook",
    "was-default-hostname": "echook.azurewebsites.net",
    "x-forwarded-proto": "https",
    "x-appservice-proto": "https",
    "x-arr-ssl": "2048|256|CN=Microsoft Azure TLS Issuing CA 01, O=Microsoft Corporation, C=US|CN=*.azurewebsites.net, O=Microsoft Corporation, L=Redmond, S=WA, C=US",
    "x-forwarded-tlsversion": "1.2",
    "x-original-url": "/echo",
    "x-waws-unencoded-url": "/echo",
    "x-client-port": "60496"
  }
}

Release Notes

Version 0.4.0

Customize request header carrying correlation id

  imports: [
    BrowserModule,
    HttpClientModule,
    NgxCorrelationIdModule.withConfig( {
      system: 'ui',
      header: 'x-your-own-header-name'
    });
    // NgxCorrelationIdModule.withConfig(['ui', 'x-your-own-header-name']) is also possible
  ],

Note: withConfig('system') is still supported

Version 0.3.0

Support a system parameter - see https://www.npmjs.com/package/simple-correlation-id for more details

  imports: [
    BrowserModule,
    HttpClientModule,
    NgxCorrelationIdModule.withConfig('ui')
  ],

Version 0.2.0

  • CorrelationId comprise of only timestamp
  • Http request header x-correlation-id is used to carry the correlation id

TODO

  • Add Test