Skip to content

hainet50b/http-client

Repository files navigation

Zed HTTP Client

A Zed extension for .http files, inspired by the HTTP Client in IntelliJ IDEA.

Note

Initial setup is required before using these features. See Installation.

Features

Run requests from the gutter

Each request gets a ▶ button. Clicking it sends the request and shows the response in the terminal panel.

Run a request

Syntax highlighting

Highlights .http and .rest files, including JSON and XML in request bodies with proper indentation.

Syntax highlighting

Variables

Define variables with @name = value at the top of the file and reference them with {{name}} in subsequent requests.

Variables

Body file references

Send a file as the request body with < ./payload.json. Variables inside the referenced file are substituted.

Body file references

Response formatting

JSON and XML response bodies are pretty-printed. Each response includes the status line, content length, and elapsed time in milliseconds.

Outline panel

All requests in the file appear in Zed's outline panel, named by their ### section title.

Outline

Re-run from task history

Each request becomes a Zed task labeled {METHOD} requests | {section title}. Past runs are available from Task: spawn.

Task history

Installation

To use this extension, complete the following two steps. Due to current Zed extension API limitations, the runner binary and task definition cannot be shipped with the extension itself.

1. Install the httpc binary

Download the prebuilt binary for your platform from Releases and place it on your PATH. ~/.local/bin/ is recommended (no sudo required); make sure the directory is on your PATH.

mkdir -p ~/.local/bin
tar -xzf httpc-x86_64-unknown-linux-gnu.tar.gz -C ~/.local/bin

2. Register the runnable task

Add the following to your global ~/.config/zed/tasks.json (or per-project .zed/tasks.json):

[
  {
    "label": "$ZED_CUSTOM_method $ZED_STEM | $ZED_CUSTOM_title",
    "command": "httpc",
    "args": ["--file", "$ZED_FILE", "--line", "$ZED_ROW"],
    "tags": ["http-request"],
    "reveal": "no_focus",
    "use_new_terminal": false,
    "allow_concurrent_runs": false
  }
]

Once both are in place, click the ▶ button next to any request to execute it.

Related Projects

Acknowledgments

This extension uses the following third-party tree-sitter grammars:

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

About

A Zed extension for .http files, inspired by the HTTP Client in IntelliJ IDEA.

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

 
 
 

Contributors