@ovh-ux/request-tagger
TypeScript icon, indicating that this package has built-in type declarations

0.4.0 • Public • Published

Request Tagger

OVHcloud manager request Tagger

Installation

yarn add @ovh-ux/request-tagger

Usage

Request Tagger is here to help us tag API requests, providing 4 headers :

  • X-OVH-MANAGER-NAVIGATION-ID: A unique navigation identifier (common for all calls in the same session)
  • X-OVH-MANAGER-REQUEST-ID: A request identifier (based on date + incremented session index)
  • X-OVH-MANAGER-PAGE: The origin page of the request
  • X-OVH-MANAGER-VERSION: The application version

Examples

Get Headers for HTTP calls to /engine/apiv6/me on homepage page in application v1.0.0.

import { defineApplicationVersion, defineApplicationPage, getHeaders } from '@ovh-ux/request-tagger';

defineApplicationVersion('v1.0.0')
defineApplicationPage('homepage');
const headers = getHeaders('/engine/apiv6/me');
// inject headers in http call

Add headers overrides based on API url pattern

import { Header, defineApplicationVersion, defineApplicationPage, getHeaders } from '@ovh-ux/request-tagger';

defineApplicationVersion('v1.0.0')
addHeadersOverride('^/engine/2api/notification', {
  [Header.PAGE]: 'notification-sidebar',
});
defineApplicationPage('homepage');
const headers = getHeaders('/engine/2api/notification');
// inject headers in http call

Readme

Keywords

none

Package Sidebar

Install

npm i @ovh-ux/request-tagger

Weekly Downloads

15

Version

0.4.0

License

BSD-3-Clause

Unpacked Size

12.8 kB

Total Files

12

Last publish

Collaborators

  • anooparveti
  • jisay
  • blary_jp
  • antleblanc
  • ovh-ux-cds
  • lizardk
  • ovh
  • marie-j