Create HTTP requests from files and run them right from your terminal
Note
The name of this library, gouache, pronounced /Ι‘wΙΛΚ/, is a french word representing a type
of paint that can react to water to update or create a new painting.
Create a new HTTP request.
touch index.httpFill in the details of your request.
GET /users HTTP/2
Host: https://jsonplaceholder.typicode.com
Accept: application/jsonInstall the binary as a global command.
go install github.com/aminnairi/gouacheRun your request.
gouache request --with-status --with-headers --with-body index.http
HTTP/2 200 OK
Server: cloudflare
X-Powered-By: Express
Content-Type: application/json; charset=utf-8
Cache-Control: max-age=43200
[
{
"id": 1,
"name": "Leanne Graham",
"username": "Bret",
"email": "[email protected]",
"address": {
"street": "Kulas Light",
"suite": "Apt. 556",
"city": "Gwenborough",
"zipcode": "92998-3874",
"geo": {
"lat": "-37.3159",
"lng": "81.1496"
}
},
...- Write HTTP requests in a friendly format
- It's just HTTP protocol and nothing else
- Run requests right from your terminal
- Run all requests from a folder recursively
- Generate request files in an interactive or programmatic way
Note
This commands needs to be run inside of a terminal with access to the go binary.
go install github.com/aminnairi/gouacheWarning
You should have the path to go installed binaries already setup in order for your terminal to have access to this program.
Note
The go binary does not have a way to uninstall a previously installed
package, but all it does is create a folder and download the sources in that
folder.
rm -rf $(which gouache)Important
If you are unsure of what the HTTP protocol is, here is a detailed article from the Mozilla Developers Network website that explains it well.
touch get.httpGET /users HTTP/2
Host: https://jsonplaceholder.typicode.com/usersWarning
There should only be one HTTP request per *.http file.
gouache request get.httpgouache request --with-status get.http
# or
gouache request -s get.httpgouache request --with-headers get.http
# or
gouache request -H get.httpgouache request --with-body get.http
# or
gouache request -b get.httptouch post.httpPOST /users HTTP/2
Host: https://jsonplaceholder.typicode.com/users
Content-Type: application/json
{
"id": 11,
"email": "[email protected]"
}gouache request post.httptouch patch.httpPATCH /users/10 HTTP/2
Host: https://jsonplaceholder.typicode.com/users
Content-Type: application/json
{
"email": "[email protected]"
}gouache request patch.httptouch put.httpPUT /users/10 HTTP/2
Host: https://jsonplaceholder.typicode.com/users
Content-Type: application/json
{
"email": "[email protected]"
}gouache request --with-status put.httptouch delete.httpDELETE /users HTTP/2
Host: https://jsonplaceholder.typicode.com/users
Content-Type: application/json
{
"id": 10,
"email": "[email protected]"
}gouache request delete.httpmkdir requests
touch requests/users.httpGET /users HTTP/2
Host: https://jsonplaceholder.typicode.comtouch requests/posts.httpGET /posts HTTP/2
Host: https://jsonplaceholder.typicode.commkdir requests/posts
touch requests/posts/first.httpGET /posts/1 HTTP/2
Host: https://jsonplaceholder.typicode.comgouache request --with-status requestsgouache generate get.http \
--method GET \
--path /users \
--url https://jsonplaceholder.typicode.com
# or
gouache generate get.http \
-m GET \
-p /users \
-u https://jsonplaceholder.typicode.comTip
Only providing one of the following: method, path or host or the path to the generated HTTP request will trigger the interactive mode asking you for the remaining informations.
gouache generate post.http \
--method GET \
--path /users \
--url https://jsonplaceholder.typicode.com \
--body '{"id":1}'Tip
Requests don't necessarily have to have a body, omitting it will not trigger the interactive mode and rather will create the request without body.
gouache generateSee LICENSE.
See CONTRIBUTING.md.
See SECURITY.md.
See CODE_OF_CONDUCT.md.