func New() *Request {
	f := &Request{}
	f.header = map[string]string{}
	f.backoff = backoff.NewExponentialBackOff()
	f.err = nil
	return f
}
Create a new request
package fluent
import (
	"bytes"
	"encoding/json"
	"errors"
	"io"
	"net/http"
	"net/url"
	"time"
	"github.com/lafikl/backoff"
)
type Request struct {
	header    map[string]string
	method    string
	json      interface{}
	jsonIsSet bool
	url       string
	retry     int
	timeout   time.Duration
	body      io.Reader
	res       *http.Response
	err       error
	backoff   *backoff.ExponentialBackOff
	req       *http.Request
	proxy     string
}
func (f *Request) newClient() *http.Client {
	return &http.Client{Timeout: f.timeout}
}
func (f *Request) newRequest() (req *http.Request, err error) {
	if f.jsonIsSet {
		body, jsonErr := json.Marshal(f.json)
		if jsonErr != nil {
			return nil, jsonErr
		}
		req, err = http.NewRequest(f.method, f.url, bytes.NewReader(body))
	} else {
		req, err = http.NewRequest(f.method, f.url, f.body)
	}
	return
}
func (f *Request) Url(url string) *Request {
	f.url = url
	return f
}
func (f *Request) Method(method string) *Request {
	f.method = method
	return f
}
func (f *Request) Post(url string) *Request {
	f.Url(url).Method("POST")
	return f
}
func (f *Request) Put(url string) *Request {
	f.Url(url).Method("PUT")
	return f
}
func (f *Request) Patch(url string) *Request {
	f.Url(url).Method("PATCH")
	return f
}
func (f *Request) Get(url string) *Request {
	f.Url(url).Method("GET")
	return f
}
func (f *Request) Delete(url string) *Request {
	f.Url(url).Method("DELETE")
	return f
}
func (f *Request) Json(j interface{}) *Request {
	f.json = j
	f.jsonIsSet = true
	f.SetHeader("Content-type", "application/json")
	return f
}
func (f *Request) Body(b io.Reader) *Request {
	f.body = b
	return f
}
func (f *Request) SetHeader(key, value string) *Request {
	f.header[key] = value
	return f
}
func (f *Request) Timeout(t time.Duration) *Request {
	f.timeout = t
	return f
}
func (f *Request) InitialInterval(t time.Duration) *Request {
	f.backoff.InitialInterval = t
	return f
}
func (f *Request) RandomizationFactor(rf float64) *Request {
	f.backoff.RandomizationFactor = rf
	return f
}
func (f *Request) Multiplier(m float64) *Request {
	f.backoff.Multiplier = m
	return f
}
func (f *Request) MaxInterval(mi time.Duration) *Request {
	f.backoff.MaxInterval = mi
	return f
}
func (f *Request) MaxElapsedTime(me time.Duration) *Request {
	f.backoff.MaxElapsedTime = me
	return f
}
func (f *Request) Retry(r int) *Request {
	f.retry = r
	return f
}
func (f *Request) Proxy(p string) *Request {
	f.proxy = p
	return f
}
func doReq(f *Request, c *http.Client) error {
	var reqErr error
	f.req, reqErr = f.newRequest()
	if reqErr != nil {
		return reqErr
	}
	for k, v := range f.header {
		f.req.Header.Set(k, v)
	}
	res, err := c.Do(f.req)
	if err != nil {
		f.err = err
		return nil
	}
	if res != nil && res.StatusCode >= 500 && res.StatusCode <= 599 && f.retry > 0 {
		f.retry--
		return errors.New("Server Error")
	}
	if res != nil {
		f.res = res
	}
	return nil
}
func (f *Request) operation(c *http.Client) func() error {
	return func() error {
		return doReq(f, c)
	}
}
func (f *Request) do(c *http.Client) (*http.Response, error) {
	err := doReq(f, c)
	if err != nil {
		op := f.operation(c)
		err = backoff.Retry(op, f.backoff)
		if err != nil {
			return nil, err
		}
	}
	if f.err != nil {
		return nil, f.err
	}
	return f.res, err
}
func (f *Request) Send() (*http.Response, error) {
	c := *http.DefaultClient
	if f.timeout != 0 {
		nc := f.newClient()
		c = *nc
	}
	if f.proxy != "" {
		proxyUrl, err := url.Parse(f.proxy)
		if err != nil {
			return nil, err
		}
		c.Transport = &http.Transport{
			Proxy: http.ProxyURL(proxyUrl),
		}
	}
	res, err := f.do(&c)
	return res, err
}