https://github.com/roberth-k/rq
rq is a wrapper for go's http client
https://github.com/roberth-k/rq
golang http http-client immutable
Last synced: 3 months ago
JSON representation
rq is a wrapper for go's http client
- Host: GitHub
- URL: https://github.com/roberth-k/rq
- Owner: roberth-k
- License: mit
- Created: 2019-07-24T23:28:11.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-03-03T20:17:34.000Z (about 6 years ago)
- Last Synced: 2026-01-12T14:49:23.243Z (3 months ago)
- Topics: golang, http, http-client, immutable
- Language: Go
- Size: 137 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
github.com/tetratom/rq
rq is a no-nonsense library for working with rest apis
# highlights
- request constructors pass values: one `rq.Request` can be used as the basis of another without copy concerns
- easy access to common operations: `Path()`, `Queryf()`, `SetHeader()`, `Is2xx()`, and many more
- support for arbitrary request, response middleware, and marshallers
- context-first
# example
```go
import "github.com/tetratom/rq"
req := rq.
Begin("https://httpbin.org").
Path("get").
Queryf("x", "y%d", 1)
rep, err := req.GET(context.Background())
switch {
case err != nil:
panic(err)
case !rep.Is2xx():
panic("bad response!")
}
log.Printf("response: %s", rep.ReadStringOrPanic())
```