kuiper

Crates.iokuiper
lib.rskuiper
version0.0.6
sourcesrc
created_at2024-09-29 13:48:41.902147
updated_at2024-10-07 08:58:01.145885
descriptionAn easy-to-use HTTP integration testing tool
homepagehttps://github.com/ijagberg/kuiper
repositoryhttps://github.com/ijagberg/kuiper
max_upload_size
id1390867
size46,126
Isak Jägberg (ijagberg)

documentation

README

kuiper

CLI tool for sending predefined HTTP requests.

Usage

To run a request:

kuiper path/to/request.kuiper -e env_file.env

Directory structure

When you run a request, kuiper traverses the directories on the way to the .kuiper file, and looks for headers.json files on the way. Header values in child directories take precedence over their parents. The request in the .kuiper file can also have headers specified, which takes precedence over everything else. Take a look at the requests folder in the source repository for this project for an example.

parent/
| headers.json {"header_a": "value_a", "header_b": "value_b"}
| request.kuiper
|   ^ this request would have {"header_a": "value_a", "header_b": "value_b"}
| child/
  | headers.json {"header_b": "value_c"}
  | request.kuiper // request file in child dir
  | ^ this request would have {"header_a": "value_a", "header_b": "value_c"}

Headers can be removed by explicitly setting them to null.

.kuiper format

.kuiper files are just JSON files, and look like this:

{
  "uri": "http://localhost/api/user/{{env:user_id}}",
  "method": "GET",
  "headers": {
    "request_specific_header_1": "request_specific_header_value_1"
  }
}

Interpolation

Values can be evaluated dynamically in two different ways when parsing a .kuiper file.

  • {{env:ENV_VAR}} This will be replaced by the value of the environment variable ENV_VAR.
  • {{expr:EXPRESSION}} This will be replaced by a value depending on what EXPRESSION is. Currently, the only supported expressions are uuid, for generating a uuid, and now for generating a timestamp.

Background

I often find myself wanting to send simple HTTP requests when I am building APIs, and historically I have used Postman for this. But Postman is a pretty bloated piece of software that does too much, and too poorly. kuiper is not intended to replace what Postman can do with automated integration tests, pre- and post-request scripts etc. It is just a tool for defining and running HTTP requests in a manner that can be source controlled.

Commit count: 31

cargo fmt