mirror of
https://codeberg.org/vlw/curl.git
synced 2025-09-14 00:33:41 +02:00
57 lines
No EOL
1.3 KiB
Markdown
57 lines
No EOL
1.3 KiB
Markdown

|
|
|
|
# Simple curl bash wrapper
|
|
|
|
<img src="https://blob.vlw.se/01/0199056d-d6fc-748b-adbb-269c8c5237ab.png">
|
|
|
|
---
|
|
|
|
**This is a very simple wrapper for curl that I use with VSCode (code-server) to make HTTP requests - like Postman but super simple.**
|
|
|
|
VSCode is not required to run this script, I use it as a GUI.
|
|
|
|
# Files
|
|
This script uses separate files for various request options. Create these files in the same directory as `curl.sh`.
|
|
|
|
## `params.txt`
|
|
URL search parameters. (Leading "?" is optional)
|
|
```
|
|
foo=bar&hello=world
|
|
```
|
|
|
|
## `payload.json`
|
|
JSON request body that will be sent with all requests (except `GET`).
|
|
```json
|
|
{
|
|
"request_body_parameter": "request_body_value"
|
|
}
|
|
```
|
|
|
|
## `headers.json`
|
|
Key-value JSON object of optional request headers.
|
|
```json
|
|
{
|
|
"X-Header-Name": "Header value"
|
|
}
|
|
```
|
|
|
|
## `disable_peer_validation`
|
|
Optional empty file that when present will disable SSL peer validation - for self-signed certificates etc.
|
|
|
|
# Make a request
|
|
Run the `curl.sh` file from your shell and pass it two parametes for URL and request method.
|
|
|
|
```sh
|
|
./curl.sh https://example.com GET
|
|
```
|
|
|
|
The response body will be printed to stdout.
|
|
|
|
*Example*
|
|
```
|
|
vlw@example:/curl$ ./curl.sh https://example.com GET
|
|
GET https://example.com?foo=bar
|
|
|
|
"This is an example response body in plaintext"
|
|
vlw@example:/curl$
|
|
``` |