riposte

Crates.ioriposte
lib.rsriposte
version0.1.2
sourcesrc
created_at2023-04-17 10:20:02.850343
updated_at2023-04-17 11:05:32.773716
descriptionOn-demand http status code response
homepage
repositoryhttps://github.com/tomascarreira/risposte
max_upload_size
id841358
size25,622
(tomascarreira)

documentation

README

Riposte

A server that allows clients to specify the response code that the server will return.

This could be useful for testing the logic of a client for rare or difficult to set up status code.

Instalation

Currently only linux is supported.

  1. Download the latest version from the releases page.
  2. Give executable permision to the binary chmod u+x path/to/riposte

Or build from source

  1. Instal cargo (the rust package manager)
  2. cargo install riposte

The binary will be on .cargo/bin/riposte.

Usage

Start the server (the port number can be specified, default is 8080)

riposte -p 8000

Make a request to the server which includes the header riposte-request: <code status>

Only http1.1 is currently supported

The request method can be anything and the path can also be anything

The code status must be in the range 100-999

The server will respond with that status code and the response will have the header riposte-response: <the status code specified>

Examples

Request:

GET / HTTP/1.1
Host: 127.0.0.1:8080
riposte-request: 418

Response:

HTTP/1.1 418 I'm a teapot
riposte-renspose: 418
content-length: 0

Request:

POST /baz HTTP/1.1
Host: foo.bar
Content-Type: application/x-www-form-urlencoded
Content-Length: 27
riposte-response: 502

field1=val1&field2=val2

Response:

HTTP/1.1 502 Bad Gateway
riposte-response: 502
content-lenght: 0
Commit count: 24

cargo fmt