Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ahf/cowboy_error_noise
Add error noise to your Cowboy project.
https://github.com/ahf/cowboy_error_noise
cowboy erlang
Last synced: about 1 month ago
JSON representation
Add error noise to your Cowboy project.
- Host: GitHub
- URL: https://github.com/ahf/cowboy_error_noise
- Owner: ahf
- License: bsd-2-clause
- Created: 2014-10-22T09:21:38.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2018-02-16T01:03:15.000Z (almost 7 years ago)
- Last Synced: 2023-04-13T04:58:06.497Z (over 1 year ago)
- Topics: cowboy, erlang
- Language: Erlang
- Homepage:
- Size: 11.7 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.markdown
- License: LICENSE
Awesome Lists containing this project
README
Cowboy Error Noise
==================This [Cowboy](https://github.com/ninenines/cowboy) middleware allows you to add
random failure into your API which forces your client's to handle API errors
more gracefully.Have a look at the example in the [examples/](examples/) directory.
## Configuring
Add `cowboy_error_noise_middleware` to your `middlewares` configuration for cowboy.
### Example Configuration
{ok, _} = cowboy:start_http(noisy_api_http, 1000, [{port, 10000}], [
{env, [
{dispatch, Dispatch},%% API Noise.
{noise_error_percent, 33.333},
{noise_error_code, 503},
{noise_error_body, <<"Ugh! You should see this message 1/3 of the time.">>},
{noise_error_content_type, <<"text/plain; charset=utf-8">>}
]},{middlewares, [cowboy_error_noise_middleware, cowboy_router, cowboy_handler]}
]),