hitt

hitt is a command line HTTP testing tool focused on speed and simplicity.

hitt example
hitt 0.0.21
Command line HTTP testing tool focused on speed and simplicity
Mads Hougesen <[email protected]>

Usage: hitt <COMMAND>

Commands:
  run          Send http requests
  sse          Listen to sse events
  completions  Generate shell completions
  help         Print this message or the help of the given subcommand(s)

Options:
  -h, --help     Print help
  -V, --version  Print version

Install

Linux & MacOS

Windows

Cargo

hitt can be installed using Cargo.

If you do not have Cargo installed, you need to install it first.

npm/npx

You can install hitt using npm:

or run it directly using npx:

Homebrew

Usage

To send a request create a file ending in .http.

The syntax of .http files is pretty straightforward:

The file can then be run using the following command:

That is all that is need to send a request.

Arguments

Argument
Description

--var <KEY>=<VALUE>

Variables to pass to request

--recursive

Run all files in directory

--fail-fast

Exit on status code 4XX or 5xx

--hide-headers

Hide response headers

--hide-body

Hide response body

--timeout <TIMEOUT_MS>

Request timeout in ms

Request headers

Request headers can be added by writing key value pairs (KEY:VALUE) on a new line after the method and URL:

Leading spaces in the header value is ignored, so KEY: VALUE and KEY:VALUE will both have the value VALUE.

Request body

A body can be sent with the request by creating a blank line, followed by the desired body input.

Please note, hitt does not infer content type. That has to be written as a header.

Multiple request in single file

Multiple requests can be written in a single file by adding a line with ### as a separator:

Variables

hitt has support for request variables.

A variable can be set in a file using the following syntax @name = VALUE. Whitespace is ignored.

Variables are used by wrapping the name in curly brackets ({{ name }}).

In-file variables are not shared between other files.

Variable arguments

Variables can be passed to all requests using the --var <KEY>=<VALUE> argument:

The file can the be run:

Server sent events (SSE)

A SSE listener can be started using the hitt sse command.

Shell completions

Shell completions can be generated using hitt completions <SHELL>.

Bash

Add the following to your .bashrc.

Zsh

Add the following to your .zshrc.

Fish

Add the following to ~/.config/fish/config.fish.

PowerShell

Add the following to your PowerShell configuration (Can be found by running $PROFILE).

Elvish

Add the following to ~/.elvish/rc.elv.

Neovim

hitt can be run directly from Neovim.

[!NOTE] The hitt executable must be available in your path for the plugin to work.

Install

Lazy

Usage

The plugin exposes a single command :HittSendRequest, which can be bound to a keymap like this:

hitt neovim window

Configuration

Name
Default
Description

window_width

80

Window width in percentage

window_height

80

Window height in percentage

fail_fast

false

Enables the --fail-fast options

HTTP syntax highlighting

Syntax highlighting can be enabled by installing the http treesitter parser (:TSInstall http) and adding a file association for .http files.

Disclaimer

hitt is most likely not ready for main stream usage. I (Mads Hougesen) am primarily developing it based on features I believe to be useful, or fun to develop.

Last updated