http-prompt Command Examples in Linux

http-prompt is an interactive command-line HTTP client that allows you to send HTTP requests to web servers and view the responses. It is built on top of the popular HTTP library requests and provides features such as autocomplete, syntax highlighting, and a built-in history.

http-prompt provides a simple and intuitive interface for making HTTP requests. You can specify the HTTP method (e.g. GET, POST, PUT, DELETE), the URL, and any additional headers or data to send with the request. The tool then sends the request and displays the response headers and body in a clear, easy-to-read format.

Here’s an example of how you might use http-prompt:

  • Start the http-prompt: http-prompt
  • Send a GET request to a URL: GET https://example.com
  • Send a POST request with a JSON payload : POST https://example.com -H “Content-Type: application/json” -d ‘{“name”:”value”}’
  • Send a PUT request with a json payload : PUT https://example.com/users/1 -H “Content-Type: application/json” -d ‘{“name”:”newvalue”}’
  • Send a DELETE request : DELETE https://example.com/users/1

http-prompt also provides features such as autocomplete for URLs and headers, syntax highlighting for the JSON and XML responses, and a built-in history that allows you to easily recall and repeat previous requests.
Additionally, it also supports the use of environment variables and custom configuration files, to keep sensitive information like api keys, secrets etc.

http-prompt Command Examples

1. Launch a session targeting the default URL of http://localhost:8000 or the previous session:

# http-prompt

2. Launch a session with a given URL:

# http-prompt http://example.com

3. Launch a session with some initial options:

# http-prompt localhost:8000/api --auth username:password
Related Post