req

command module
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 27, 2023 License: MIT Imports: 9 Imported by: 0

README

req

CLI Application for running .http files

asciicast

Installation

go install github.com/go-rq/req@latest

Usage

# load all requests in the current directory tree
req

# load all requests from the directory tree at the specified path
req ./path/to/dir

req --help
Usage of req:
  -e string
        path to .env file (shorthand)
  -env string
        path to .env file

.http File Syntax

### <name of request>
< {% <pre-request
javascipt> %} 

<method> <url>
<header>:<value>
...

<request body>

< {% <post-request 
javascript> %}
Scripts

Scripts can be embedded in the .http request directly or loaded from

### <name of request>
< path/to/script.js

<method> <url>
<header>:<value>
...

<request body>

< path/to/script.js
Examples
### Create a User
< {% 
    setEnv('host', 'http://localhost:8000');
    setEnv('name', 'r2d2');
%}
POST {{host}}/users
Content-Type: application/json

{
    "name": "{{name}}"
}

< {% 
    assert(response.status === 200, 'response code is 200');
%}

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal
tui

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL