http

module
v0.0.0-...-e0889ae Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2019 License: MIT

README

Http

Status GoDoc codecov Go Report Card

http implements a JSON serializer for use with http clients and a composable mechanism to decode JSON responses and retry requests.

Directories

Path Synopsis
Package json adds composition friendly JSON support to HTTP clients A HTTP client request can be constructed using NewRequest which takes fluent functional args to specify the Body and Query parameters: // queryArgs can be any type that can be serialized by // github.com/google/go-querystring/query" queryArgs := struct { Foo int Hoo string }{ 42, "something" } // body can be any type that can be serialied to JSON body := struct { Hey string }{ "Hey!" } // make a HTTP request with these req, err := json.NewRequest( "GET", url, json.Query(queryArgs), json.Body(body), ) The response can then be sent using standard http.Client mechanisms.
Package json adds composition friendly JSON support to HTTP clients A HTTP client request can be constructed using NewRequest which takes fluent functional args to specify the Body and Query parameters: // queryArgs can be any type that can be serialized by // github.com/google/go-querystring/query" queryArgs := struct { Foo int Hoo string }{ 42, "something" } // body can be any type that can be serialied to JSON body := struct { Hey string }{ "Hey!" } // make a HTTP request with these req, err := json.NewRequest( "GET", url, json.Query(queryArgs), json.Body(body), ) The response can then be sent using standard http.Client mechanisms.
Package retry implements a http.RoundTripper that retries requests This package uses a configurable ExponentialBackoff mechanism: r := retry.Transport { Backoff: backoff.NewExponentialBackoff(), ShouldRetry: /* optional custom retry check function */, Transport: /* chain transports! */, } client := http.Client{Transport: r} res, err := client.Do(http.NewRequest("GET", url, nil))
Package retry implements a http.RoundTripper that retries requests This package uses a configurable ExponentialBackoff mechanism: r := retry.Transport { Backoff: backoff.NewExponentialBackoff(), ShouldRetry: /* optional custom retry check function */, Transport: /* chain transports! */, } client := http.Client{Transport: r} res, err := client.Do(http.NewRequest("GET", url, nil))

Jump to

Keyboard shortcuts

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