mimiclatency

package module
v0.0.0-...-3a70122 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 19, 2019 License: MIT Imports: 2 Imported by: 0

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,
})

Documentation

Overview

Package mimiclatency provides a middleware that produces latency for the http://ant0ine.github.io/go-json-rest/ package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MimicLatencyMiddleWare

type MimicLatencyMiddleWare struct {

	// Default value of duration is 0 seconds
	Duration time.Duration
}

MimicLatencyMiddleWare mimics latency on the server. This is ideally not suited for production use.

func (MimicLatencyMiddleWare) MiddlewareFunc

MiddlewareFunc makes MimicLatencyMiddleWare implement the Middleware interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL