1.1.3 • Published 9 years ago

httprompt v1.1.3

Weekly downloads
1
License
MIT
Repository
github
Last release
9 years ago

HTTPrompt

Build Status Coverage Status

httprompt is an interactive command-line API client.

Installation

Either fork and run manually, or install via npm:

npm install -g httprompt

This installs httprompt to your bin path.

Usage

Run httprompt to open the prompt. Common commands:

  • GET <url>
  • POST <url> <payload>
  • PUT <url> <payload>
  • DELETE <url>
  • type help to see more

Currently only JSON payloads are supported. <payload> can either be:

Key/Value Pairs

POST /register username=admin password=letmein

POST /comments message="some message with spaces"

If you need more complex data entry, you'll probably want to use the embedded JSON.

Embedded JSON

POST /register { "username": "admin", "password": "letmein" }

JSON payloads must be well-conformed (keys must be quoted).

External Viewers

By default, each command will just dump output to the screen, which may be hard to read. By running the open command, httprompt open the last response in your external. viewer. Alternatively, open <command> to always open a command externally.

Configuration

You can manage config in the app with config set <key> <value>, or you can run config edit to open the config file in your $EDITOR.

Options:

  • default.profile sets the default profile to use
  • external sets the default external viewer. defaults to less
  • external.json sets the default external json viewer. defaults to less. jsonfui is recommended as a better alternative
  • vim sets vim keys (hjkl to move around, modes, etc)

Profiles

Edit the profiles config option to add new profiles.

The profile specified by default.profile is loaded by default, or optionally specify another with httprompt -p <profileName>

  • baseUrl: sets the base URL (prepend to all URLs). Example: http://yoursite.com or http://localhost:8888
  • vars: set arbitrary variables here that you can use in commands. For example, if you set username and password, you could use $(profile.username) and $(profile.password) in commands and they would be expanded.
  • startupTasks: defines an array of tasks to run when opening a profile for the first time
  • actions: defines custom commands made up of existing commands. For example, you could define login:
  "baseUrl": "http://localhost:8888",
  "actions": {
    "login <username> <password>": [
      "POST /login username=$(input.username) password=$(input.password)"
    ]
  }

then you could open the app and run login admin letmein and it would post to that URL.

1.1.3

9 years ago

1.1.2

9 years ago

1.1.1

9 years ago

1.1.0

9 years ago

1.0.11

9 years ago

1.0.10

9 years ago

1.0.9

9 years ago

1.0.8

9 years ago

1.0.7

9 years ago

1.0.6

9 years ago

1.0.5

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago