An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

github.com/tetratom/rq




GoDoc


CircleCI


Codecov


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())
```