curlie
Send HTTP requests from the command line
TLDR
Send a GET request
Send a POST request
Send a GET request with query parameters (e.g. first_param=5&second_param=true)
Send a GET request with a custom header
SYNOPSIS
curlie [options] url
PARAMETERS
-H header
Pass a custom header to server (can be repeated).
-d data
Sends the specified data in a POST request.
-X command
Specifies the HTTP command to use (e.g., GET, POST, PUT, DELETE).
-o file
Write output to file instead of stdout.
-L
Follow redirects.
-k
Allow insecure server connections when using SSL.
--lua-script script
Specify a Lua script to execute.
--lua-eval string
Execute Lua code directly from the command line.
--help
Show help message and exit.
--version
Show version information and exit.
DESCRIPTION
curlie is a command-line HTTP client that wraps the popular curl tool, extending its functionality with Lua scripting. This allows for more flexible and programmable interaction with web servers. It enables users to define custom request headers, modify request bodies, handle complex authentication schemes, and parse server responses using the Lua scripting language. curlie leverages libcurl for core HTTP handling but adds a powerful scripting layer, making it suitable for tasks like automated API testing, data extraction, and web application interaction where standard curl is insufficient.
By embedding Lua, curlie can perform tasks like dynamically constructing URLs, adding conditional logic to request building, and generating complex report formats based on received data. While curl offers extensive command-line options, curlie offers a more structured and programmable environment, beneficial for users needing more refined control over HTTP requests and responses.
CAVEATS
curlie relies on both curl and Lua being installed on the system. Error messages can sometimes be difficult to interpret, especially when Lua scripts have issues. Debugging Lua scripts may require additional tooling.
LUA SCRIPTING
Lua scripts can access and modify the request before it is sent and process the response received from the server. This allows for complex logic such as parsing JSON data, manipulating request headers based on response content, and handling authentication tokens.
The following global functions are available: `request` (manipulate the request), `response` (process the response), and `print` (for debugging output).
EXAMPLE USAGE
A simple example to add a custom header: curlie -H 'X-Custom-Header: value' http://example.com
An example using a Lua script to modify headers: curlie --lua-script=my_script.lua http://example.com
Where my_script.lua contains:request.headers['X-Another-Header'] = 'another_value'