Skip to content

vncsmyrnk/ashttp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CI workflow Release workflow codecov contributions Issue count

An HTTP Client as a CLI

A command-line HTTP client tool that simplifies API requests using configurable URL aliases and a CLI syntax. It is a CLI meant to simplify constant and useful HTTP requests without relying on more complex HTTP clients like cURL.

It allows you to make API requests using predefined URL aliases instead of full URLs. It's designed to streamline your workflow when working with multiple APIs by providing a simple, intuitive command-line interface with configuration-based URL management.

ashttp httpbin get users 456 profile --include "posts,comments"

# Will be equivalent to:
# curl https://httpbin.dev/anything/users/456/profile?include=posts,comments

This solves the common overhead problem of managing multiple API endpoints with all sorts of authorization and specific headers.

Usage

ashttp <URL-alias> <http-method> [path-components...] [--option value]

Configuration

The configuration file is automatically created at ~/.config/ashttp/config.json with a default httpbin example:

{
  "httpbin": {
    "url": "https://httpbin.dev/anything",
    "defaultHeaders": {
      "authorization": "123"
    }
  }
}

Using this configuration, the command below demonstrates how ashttp translates to the equivalent curl request:

ashttp httpbin get users 456 profile --include "posts,comments"

# Will be equivalent to:
# curl https://httpbin.dev/anything/users/456/profile?include=posts,comments \
#    -H "authorization: 123"

Installation

go install github.com/ashttp@latest

Development

This project is currently under development so unexpected behaviors may happen. Only GET and DELETE methods are supported until now.

Check the releases page to see more details about versions and binaries.

About

A command-line HTTP client tool that simplifies API requests using configurable URL aliases and a CLI syntax.

Topics

Resources

License

Stars

Watchers

Forks

Contributors