grunt-connect-delay

grunt-connect-delay

This plugin provides a delay middleware for Grunt Connect / Express. It can be
used for introducing artificial delays before proxying certain URLs based on
RegExp rules.

By default, it includes the rule that any URL which matches the pattern
^/delay/([0-9]+)/(.*)$ will be delayed by $1 milliseconds and be redirected
to /$2.

Hence, to check your app's behavior when a particular request is slow, just
prefix /delay/5000/ to the URL.

Getting started

This plugin requires Grunt ~0.4.1

If you haven't used Grunt before, be sure to check out
the Getting Started guide, as it explains
how to create a Gruntfile as well as
install and use Grunt plugins.

npm install grunt-connect-delay --save-dev

Options

useDefaultRule

Type: Boolean

Default Value: true

This adds the following default rule to the configuration:

{ rule :'/delay/([0-9])+/(.*)$'

, delay :'$1'

, rewrite :'/$2'

}

This means that to delay a link, you only need to prefix it with
/delay/:milliseconds/<original URL>. grunt-connect-delay will wait for the
said number of milliseconds before proceeding to the <original URL>

rulesProvider

Type: String

Default value: connect.delay

This is the section in the Gruntfile from where the delay rules will be read.

Simple rule format

{url: 'FROM', delay: MILLISECONDS }

Where:

FROM: RegExp string to match

MILLISECONDS: The delay in milliseconds to introduce before proceeding with proxying