fetch

command module
v1.0.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2023 License: Apache-2.0 Imports: 1 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

fetch

fetch is a lightweight and powerful API testing tool.

You can use git and configuration files (e.g. yaml/toml) to maintain all test cases.

See https://wklken.me/fetch for more information.

Installation

Binary releases

See the available binaries for different operating systems/architectures from the releases page.

go install
go install github.com/wklken/fetch@latest
hombrew
brew tap wklken/fetch
brew install fetch
docker
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.19
git clone https://github.com/wklken/fetch.git
cd fetch
make build

Getting Started

request:
  method: get
  url: 'http://httpbin.org/get'
assert:
  status: ok
  statusCode: 200
  contentLength_gt: 180
  contentType: application/json

run

$ ./fetch run http_get.yaml

See examples for a variety of examples.

Features

  • config file types: yaml/toml/json/properties/ini
  • http methods: get/post/put/delete/patch/head/options
  • build request: file/template(go 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)/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

License

Copyright (c) 2021-present wklken

Licensed under MIT License

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg
log
tpl

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL