Categorygithub.com/mrwaggel/go-json-rest-middleware-mimiclatency
modulepackage
0.0.0-20190219060444-3a70122b1c3f
Repository: https://github.com/mrwaggel/go-json-rest-middleware-mimiclatency.git
Documentation: pkg.go.dev

# README

go-json-rest-middleware-mimiclatency

godoc license

Middleware to produce latency for Go-Json-Rest.

This is ideally used during development, to test how clients behave with high latency.

Installation

You can do the usual:

go get github.com/MrWaggel/go-json-rest-middleware-mimiclatency

Usage

Import

Add the following imports.

import (
	"github.com/MrWaggel/go-json-rest-middleware-mimiclatency"
	"time"
)

Add middleware

To add a delay of two seconds to your api requests.

api.Use(&mimiclatency.MimicLatencyMiddleWare{
	Duration:time.Second * 2,
})

# Structs

MimicLatencyMiddleWare mimics latency on the server.