snakecharmer / Kitura-ResponseTime

Middleware for recording response times of requests

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Kitura-ResponseTime

Middleware for Kitura.

This module tracks the response time for HTTP requests and sends the time back in the response header. Response time is defined as the elapsed time from when the request is processed by this middleware to the time when the response is sent out in miliseconds.

Installation

Add this repo to your package dependencies in your Package.swift.

Use

import Kitura
import ResponseTime

let router = Router()
router.all(middleware: ResponseTime())

Options

ResponseTime(precision:, headerName:, includeSuffix:)

precision

The number of digits to include after the decimal point, defaults to 3 (ex: 4.143ms).

headerName

The name of the header to set, defaults to X-Response-Time.

includeSuffix

Whether to include the ms suffix, defaults to true.

About

Middleware for recording response times of requests

License:Apache License 2.0


Languages

Language:Swift 100.0%