https://github.com/wklken/fetch
A command line http test tool. Maintain the case via git and pure text
https://github.com/wklken/fetch
apitest cli httptest newman
Last synced: about 1 year ago
JSON representation
A command line http test tool. Maintain the case via git and pure text
- Host: GitHub
- URL: https://github.com/wklken/fetch
- Owner: wklken
- License: apache-2.0
- Created: 2021-06-27T13:48:58.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-12-16T12:21:02.000Z (over 2 years ago)
- Last Synced: 2024-06-21T17:07:19.538Z (about 2 years ago)
- Topics: apitest, cli, httptest, newman
- Language: Go
- Homepage: https://wklken.me/fetch/
- Size: 1.44 MB
- Stars: 17
- Watchers: 4
- Forks: 3
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# fetch
fetch is a **lightweight** and **powerful** API testing tool.
You can use git and yaml files to maintain all test cases.
See [https://wklken.me/fetch](https://wklken.me/fetch) for more information.
## Installation
### Binary releases
See the available binaries for different operating systems/architectures from the [releases page](https://github.com/wklken/fetch/releases).
### go install
```bash
go install github.com/wklken/fetch@latest
```
### hombrew
```bash
brew tap wklken/fetch
brew install fetch
```
### docker
```bash
docker run --rm --net=host wklken/fetch help
# apple m1*/m2*
docker pull --platform=linux/amd64 wklken/fetch
docker run --rm --net=host wklken/fetch help
```
### Build from source
- dependencies: go1.21
```bash
git clone https://github.com/wklken/fetch.git
cd fetch
make build
```
## Getting Started
```yaml
request:
method: get
url: 'http://httpbin.org/get'
assert:
status: ok
statusCode: 200
contentLength_gt: 180
contentType: application/json
```
run
```bash
$ ./fetch run http_get.yaml
```

See [examples](https://github.com/wklken/fetch/tree/master/examples) for a variety of examples.
## Features
- http methods: get/post/put/delete/patch/head/options
- build request: file/template([go template](https://golang.org/pkg/text/template/))/set cookie/basic auth/share cookie/msgpack
- assert response:
- status/statusCode/contentLength/contentType/body
- latency
- numeric support `_in/_not_in/_lt/_lte/_gt/_gte`
- string support `_contains/_not_contains/_startswith/_endswith`
- proto/protoMajor/protoMinor
- redirect
- header/cookie/error/json([jmespath](https://jmespath.org/tutorial.html))/html(xpath)/xml(xpath)/yaml/toml/redirect
- cli:
- progress bar
- show stats
- verbose mode: `-v` or set `export FETCH_DEBUG = true`
- quiet mode: `-q/--quiet` to silent the print, for check `$?` only
- run in order / run in parallel
- set failFast/timeout
## Feedback
If you have any feedback, please create an [issue](https://github.com/wklken/fetch/issues)
## License
Copyright (c) 2021-present [wklken](https://github.com/wklken)
Licensed under [MIT License](https://github.com/wklken/fetch/blob/master/LICENSE)