Skip to content

ahf/cowboy_error_noise

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cowboy Error Noise

This 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/ 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]}
]),

About

Add error noise to your Cowboy project.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published