Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/indiependente/srs

Slow Request Simulator
https://github.com/indiependente/srs

Last synced: 5 days ago
JSON representation

Slow Request Simulator

Awesome Lists containing this project

README

        

# Slow Request Simulator (SRS)

SRS is a simple Go program that simulates a timeout bounded HTTP server where execution time of each request can be set using a url query param.

## Server
`./srs 5`

```bash
./srs n

n must be an integer representing the number of seconds before the server times out
```

## Client
`curl localhost:8090/hello\?t=6`

```bash
curl localhost:8090/hello\?t=6

t must be an integer representing the number of seconds the request will take to complete
```

## Example using http CLI

- Happy path (request takes less or as much as timeout allows)
```bash
http :8090/hello\?t=5
HTTP/1.1 200 OK
Content-Length: 9
Content-Type: text/plain; charset=utf-8
Date: Thu, 01 Oct 2020 14:55:36 GMT

all good
```

- Sad path (request takes longer than timeout allows)
```bash
http :8090/hello\?t=6
HTTP/1.1 500 Internal Server Error
Content-Length: 26
Content-Type: text/plain; charset=utf-8
Date: Thu, 01 Oct 2020 15:03:32 GMT
X-Content-Type-Options: nosniff

context deadline exceeded

```