JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 189
  • Score
    100M100P100Q78995F
  • License MIT

HTTP request helper for mimik microservices

Package Exports

  • @mimik/request-helper
  • @mimik/request-helper/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@mimik/request-helper) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

request-helper

Example

import requestHelper from '@mimik/request-helper';
or
import { getCorrelationId, getUserAgent, setUserAgent } from '@mimik/request-helper';

request-helper~getCorrelationId(request) ⇒ UUID.<string>

Get the correlationId from the request. If it does not exist, a new correlationId step 0 and time will be created. Add step if it does not exist, add date if it does not exist. Increment step is it exist, and set step to 0 if step is not a number.

Kind: inner method of request-helper
Returns: UUID.<string> - The correlationId.
Category: sync

Param Type Description
request object The request from which to extract the correlationId or a string

request-helper~getUserAgent(request) ⇒ string

Get the userAgent from the request.

Kind: inner method of request-helper
Returns: string - The user agent from the request.
Category: sync

Param Type Description
request object The request from which to extract the correlationId or a string

request-helper~setUserAgent() ⇒ string

The following environment variable are being optionnaly used:

Env variable name Description Default Comments
SERVER_TYPE type of the server instance that makes the call generic for defining the agent
SERVER_VERSION version of the server instance that makes the call 1.0 for defining the agent
SERVER_ID id of the server instance that makes the call generic for defining the agent

Kind: inner method of request-helper
Returns: string - The user agent to be added to the request.
Category: sync