Skip to content

ideaspaper/restclient

Repository files navigation

restclient

restclient is a command-line HTTP client inspired by the VS Code REST Client extension. It lets you send requests directly from .http and .rest files, manage session-scoped environments, run scripts, and replay request history from the terminal.

Features

  • Parse and execute requests from .http and .rest files
  • Interactive fuzzy-search selector for multi-request files and history replay
  • JavaScript scripting for pre-request setup, post-response tests, and chaining requests
  • Postman Collection v2.1.0 import/export
  • Session-scoped environments, cookies, and script variables
  • File variables, .env support, system variables, and user input variables
  • Streaming multipart/form-data uploads and file uploads
  • GraphQL support (queries, mutations, subscriptions)
  • Basic, Digest, and AWS Signature v4 authentication
  • PEM client certificates for mutual TLS (mTLS)
  • TLS and proxy configuration per session
  • Request history with replay
  • Colored output with JSON/XML formatting and configurable default preview mode
  • Shell completion for bash, zsh, fish, and PowerShell

Documentation

  • Commands - Usage of send, env, history, session, completion, postman
  • HTTP File Format - Syntax guide, request metadata, query params, form data, GraphQL
  • Variables - File, environment, system, and user input variables
  • Scripting - Pre-request/post-response scripts, API reference, utility functions
  • Authentication - Basic, Digest, AWS Signature v4
  • Configuration - Global config, session config, TLS, proxy, client certificates
  • Troubleshooting - Common errors and solutions

Installation

Using Homebrew

brew tap ideaspaper/tap
brew install --cask restclient

Using go install

go install github.com/ideaspaper/restclient@latest

From Source

git clone https://github.com/ideaspaper/restclient.git
cd restclient
go build -o restclient .

Quick Start

  1. Create a request file (api.http):

    @baseUrl = https://api.example.com
    
    ### Get users
    # @name getUsers
    GET {{baseUrl}}/users
    Authorization: Bearer {{token}}
    
    ### Create user
    # @name createUser
    POST {{baseUrl}}/users
    Content-Type: application/json
    
    {
      "name": "John Doe"
    }
  2. Send a request:

    # Interactive selection
    restclient send api.http
    
    # Send by name
    restclient send api.http --name getUsers
    
    # Show only headers for this run
    restclient send api.http --headers

Configuration Model

restclient separates configuration into two layers:

  • Global config: ~/.restclient/config.json
    • CLI display preferences such as previewOption and showColors
  • Session config: ~/.restclient/session/<kind>/<id>/config.json
    • HTTP behavior such as timeouts, TLS, proxy, default headers, environments, and client certificates

Session state is stored alongside the session config, including:

  • environments.json
  • cookies.json
  • variables.json

Persisted local state under ~/.restclient/ is stored with owner-only permissions.

For full details and examples, see docs/configuration.md.

License

MIT License - see LICENSE file for details.

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors