HTTP decelerator for AngularJS
A lightweight HTTP interceptor for AngularJS that allows you to slow down HTTP responses provided by
- Plug and play: requires no changes to your code!
- Supports milliseconds e.g. slow down HTTP responses by 2000ms
- Supports percentages e.g. slow down HTTP responses by 300%
- Logs deceleration to the console for debugging purposes
Why use it?
During development of your AngularJS application it is often hard to see how your application deals with slow HTTP responses.
Example: a loader shown when a form is posting data is not working correctly but you can't see it because the response gets in too quickly and the loader is hidden too fast.
HTTP decelerator conveniently allows you to simulate a slow connection without changing your own code so you can control the speed of the responses.
First install the package using Bower:
then include the file in your scripts:
and finally add the module to your AngularJS application:
To decelerate requests, add
$httpProvider.interceptors like this:
By default, HTTP decelerator will decelerate all HTTP responses by 1000ms, but you can easily change this behavior.
- Refactor distribution names for better compatibility with official angular packages
- Add support for percentages
- Add support for strings with 'ms' for easier reading
- Used in production so bump to v1.0.0
- Refactor as provider
- Add more detailed logging
- Add deceleration logging
- Initial working version