A local-only, git-friendly scratchpad for testing API endpoints in your terminal. Define, chain, and automate HTTP requests using simple TOML configuration files.
Warning
This project is in its early stages and may undergo many breaking changes in the future.
- Chain Multiple HTTP Requests: Define a sequence of HTTP requests in a
requests.toml
file. - Dynamic Placeholders: Use placeholders in URLs, headers, and bodies that are resolved at runtime.
- Flexible Dependency Resolution: Resolve placeholders from multiple sources:
- Environment Variables
- Environment files (TOML)
- Previous request responses
- User prompts
- Automatic Value Caching: Save user-prompted values to the environment file for future use.
- Supports GET and POST Methods: Easily configure HTTP methods in your request definitions.
-
Clone the Repository:
git clone [email protected]:johnnyfreeman/glint.git cd glint
-
Build and Install the Application:
cargo install --path .
You can now run glint
from your terminal.
To run glint
with a specific example file, use the following command:
glint examples/github.toml
You can find more examples in the examples/ directory.
-
Placeholder Resolution:
- Placeholders like
{name}
and{email}
in your requests are replaced with actual values at runtime. - If a value is missing in the
env_file
, the application will prompt you to input it, saving it for future use.
- Placeholders like
-
Request Execution:
- Requests are executed sequentially, following the order defined in the
requests.toml
file. - You can extract values from previous responses to populate placeholders in subsequent requests.
- Requests are executed sequentially, following the order defined in the
-
Dependency Handling:
- Dependency sources include:
envfile
: Reads values from a TOML file.request
: Retrieves values from previous request responses.
- Dependency sources include:
Each request is defined under the [[requests]]
table in the requests.toml
file. The request can include the following fields:
name
: A unique identifier for the request.method
: The HTTP method to use (e.g.,GET
,POST
).url
: The target URL, which may include placeholders.headers
: Optional HTTP headers.body
: Optional request body, which may include placeholders.dependencies
: Dependencies required to resolve placeholders before sending the request.
Dependencies specify how placeholders should be resolved. Supported sources include:
envfile
: Reads values from a TOML file.env_file
: Path to the environment file.key
: The key to look for in the file.prompt
: (Optional) Prompt message if the key is not found.
request
: Extracts values from a previous request's response.request
: The name of the previous request.path
: The JSONPath expression to extract the value (e.g.,$.token
).
Placeholders, denoted by {placeholder_name}
, are dynamically resolved from their dependencies at runtime. They can be used in the URL, headers, or body of the request.