@mimik/request-helper
v1.7.11
Published
HTTP request helper for mimik microservices
Downloads
364
Readme
request-helper
Example
const { getCorrelationId } = require('@mimik/request-helper');
- request-helper
- ~getCorrelationId(request) ⇒ UUID.<string>
- ~getUserAgent(request) ⇒ string
- ~setUserAgent() ⇒ string
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