{"repo":"uphold/koa-requestid","free":true,"listed":false,"github":"https://github.com/uphold/koa-requestid","clone":"git clone https://github.com/uphold/koa-requestid.git","description":"A middleware that adds a request id to a koa application","language":"JavaScript","stars":13,"topics":["koa2","request","tracing","middleware"],"license":"MIT","category":"analytics","readme_excerpt":"koa-requestid Status [![npm version][npm-image]][npm-url] [![CI][ci-image]][ci-url] Installation Install the package via yarn : or via npm : Usage Use koa-requestid as a middleware for a koa app. By default, it generates a unique uuid (v4) and exposes it on the response via the Request-Id header. The id is also saved as part of the request state . In the following example, the generated uuid is manually exposed on the body for debugging purposes: Execute a request to the running app: Sometimes it is also useful to pass a custom id via a request header or query string, specifically in debugging sessions. Please note that the input id is not sanitized, so the usual precautions apply. Using the above snippet to send a custom via the default Request-Id header: or using a query string parameter (default is requestId ): Configuration Arguments 1. options (object) : A dictionary of options. Options 1. expose (string false) : The name of the header to expose the id on the response, or false to disable. 2. header (string false) : The name of the header to read the id on the request, or false to disable. 3. query (string false) : The name of the header to read the id on the query string, or false to disable. Example: This configuration would expose every generated request id via the X-Request-Id response header and accept a custom id via the X-Req-Id header or request-id query string parameter. Tests Release License MIT [npm-image]: https://img.shields.io/npm/v/koa-requestid.svg [npm-u","default_branch":null,"files":null,"tree":[],"storefront":"/r/uphold","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/uphold/koa-requestid/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}