https://github.com/followtheprocess/req
Work with .http files on the command line
https://github.com/followtheprocess/req
Last synced: 3 months ago
JSON representation
Work with .http files on the command line
- Host: GitHub
- URL: https://github.com/followtheprocess/req
- Owner: FollowTheProcess
- License: mit
- Created: 2025-03-08T07:38:33.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2025-03-15T17:22:22.000Z (3 months ago)
- Last Synced: 2025-03-15T18:25:40.033Z (3 months ago)
- Language: Go
- Size: 187 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# req
[](https://github.com/FollowTheProcess/req)
[](https://goreportcard.com/report/github.com/FollowTheProcess/req)
[](https://github.com/FollowTheProcess/req)
[](https://github.com/FollowTheProcess/req/actions?query=workflow%3ACI)
[](https://codecov.io/gh/FollowTheProcess/req)Execute `.http` files from the command line
> [!WARNING]
> **req is in early development and is not yet ready for use**
## Project Description
`req` is a command line toolkit to execute `.http` files
```plaintext
// Comments can begin with slashes '/' or hashes '#' and last until the next newline character '\n'
# This is also a comment (I'll use '/' from now on but you are free to use both)// Global variables (e.g. base url) can be defined with '@ident = '
@base = https://api.company.com// 3 '#' in a row mark a new HTTP request, with an optional name e.g. 'Delete employee 1'
### [name]
HTTP_METHOD
Header-Name:// You can also give them names like this, although names like this
// do not allow spaces e.g. 'Delete employee 1' must be 'DeleteEmployee1'
###
# @name
# @name=
# @name =
HTTP_METHOD
...// Global variables are interpolated like this
### Get employee 1
GET {{base}}/employees/1// Pass the body of requests like this
### Update employee 1 name
PATCH {{base}}/employees/1
Content-Type: application/json{
"name": "Namey McNamerson"
}
```See the [Spec] and [Syntax Guide] for more info.
> [!NOTE]
> The custom javascript portions (e.g. the `{% ... %}` blocks) of the spec are **not** implemented as these are editor specific and require a javascript runtime.## Installation
Compiled binaries for all supported platforms can be found in the [GitHub release]. There is also a [homebrew] tap:
```shell
brew install FollowTheProcess/tap/req
```## Quickstart
Given a `.http` file containing http requests like this:
```plaintext
// demo.http@base = https://localhost:5167
### Create a new item
POST {{base}}/todoitems
Content-Type: application/json
{
"id": "{{ $guid }}",
"name":"walk dog",
"isComplete":false
}
### Get All items
GET {{base}}/todoitems
### Update item
PUT {{base}}/todoitems/1
Content-Type: application/json
{
"id": 1,
"name":"walk dog",
"isComplete": true
}
### Delete item
DELETE {{base}}/todoitems/1
```You can invoke any one of them, like this...
```shell
req do ./demo.http --request "Get All items"
```### Credits
This package was created with [copier] and the [FollowTheProcess/go_copier] project template.
[copier]: https://copier.readthedocs.io/en/stable/
[FollowTheProcess/go_copier]: https://github.com/FollowTheProcess/go_copier
[GitHub release]: https://github.com/FollowTheProcess/req/releases
[homebrew]: https://brew.sh
[Spec]: https://github.com/JetBrains/http-request-in-editor-spec
[Syntax Guide]: https://www.jetbrains.com/help/idea/exploring-http-syntax.html