5 releases

0.0.6 Oct 7, 2024
0.0.5 Oct 2, 2024
0.0.1 Sep 29, 2024

#79 in Testing

Download history 389/week @ 2024-09-27 218/week @ 2024-10-04 32/week @ 2024-10-11 3/week @ 2024-10-18

305 downloads per month

MIT license

30KB
457 lines

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.

Dependencies

~11–23MB
~311K SLoC