func Gets(serviceName string) *Client {
	return Service(serviceName, http.MethodGet)
}
Gets returns *Client with service name ang http get method
package httpc
import (
	"bytes"
	"compress/gzip"
	"encoding/json"
	"encoding/xml"
	"errors"
	"fmt"
	"io"
	"io/ioutil"
	"mime/multipart"
	"net"
	"net/http"
	"net/http/cookiejar"
	"net/url"
	"os"
	"path"
	"strings"
	"time"
	"github.com/axfor/bast/logs"
	"github.com/axfor/bast/service"
	"gopkg.in/yaml.v2"
)
var (
	DefaultRetries = 3
	DefaultCookieJar http.CookieJar
	defaultTransport *http.Transport
	defaultClient    *http.Client
	before           func(*Client) error
	after            func(*Client)
	defaultDiscovery *service.Discovery
)
type Client struct {
	Req       *http.Request
	files     map[string]string
	params    url.Values
	client    *http.Client
	Conf      Settings
	Tag       string
	resp      *http.Response
	err       error
	body      []byte
	bodyClose bool
}
type Settings struct {
	Transport       http.RoundTripper
	EnableCookie    bool
	Retry           int
	Log             bool
	Title, LogTitle string
}
func (c *Client) MarkTag(tag string) *Client {
	c.Tag = tag
	return c
}
func (c *Client) Client(client *http.Client) *Client {
	if client != nil {
		c.client = client
	} else {
		c.client = defaultClient
	}
	return c
}
func (c *Client) Request(request *http.Request) *Client {
	if request != nil {
		c.Req = request
	}
	return c
}
func (c *Client) Title(title string) *Client {
	c.Conf.Title = title
	return c
}
func (c *Client) Logging() *Client {
	c.Conf.Log = true
	return c
}
func (c *Client) Unlogging() *Client {
	c.Conf.Log = false
	return c
}
func (c *Client) Transport(transport http.RoundTripper) *Client {
	c.Conf.Transport = transport
	return c
}
func NewTransport() *http.Transport {
	return &http.Transport{
		Proxy: http.ProxyFromEnvironment,
		DialContext: (&net.Dialer{
			Timeout:   30 * time.Second,
			KeepAlive: 30 * time.Second,
			DualStack: true,
		}).DialContext,
		ForceAttemptHTTP2:     true,
		MaxIdleConns:          100,
		IdleConnTimeout:       90 * time.Second,
		TLSHandshakeTimeout:   10 * time.Second,
		ExpectContinueTimeout: 1 * time.Second,
	}
}
func (c *Client) Settings(settings Settings) *Client {
	c.Conf = settings
	return c
}
func (c *Client) Retries(retries int) *Client {
	c.Conf.Retry = retries
	return c
}
func (c *Client) EnableCookie(enableCookie bool) *Client {
	c.Conf.EnableCookie = enableCookie
	return c
}
func (c *Client) UserAgent(useragent string) *Client {
	if c.Req.UserAgent() == "" {
		c.Req.Header.Set("User-Agent", useragent)
	}
	return c
}
func (c *Client) Accept(accept string) *Client {
	c.Req.Header.Set("Accept", accept)
	return c
}
func (c *Client) SetBasicAuth(username, password string) *Client {
	c.Req.SetBasicAuth(username, password)
	return c
}
func (c *Client) CheckRedirect(checkRedirect func(req *http.Request, via []*http.Request) error) *Client {
	c.client.CheckRedirect = checkRedirect
	return c
}
func (c *Client) Jar(jar http.CookieJar) *Client {
	c.client.Jar = jar
	if jar != nil {
		c.Conf.EnableCookie = true
	}
	return c
}
func (c *Client) Header(key, value string) *Client {
	c.Req.Header.Set(key, value)
	if key == "Cookie" {
		c.Conf.EnableCookie = true
	}
	return c
}
func (c *Client) Cookie(cookie *http.Cookie) *Client {
	c.Req.AddCookie(cookie)
	if cookie != nil {
		c.Conf.EnableCookie = true
	}
	return c
}
func (c *Client) File(fileName, path string) *Client {
	if c.files == nil {
		c.files = map[string]string{}
	}
	c.files[fileName] = path
	return c
}
func (c *Client) Files(paths map[string]string) *Client {
	if c.files == nil {
		c.files = map[string]string{}
	}
	for k, v := range paths {
		c.files[k] = v
	}
	return c
}
func (c *Client) Param(key string, value interface{}) *Client {
	if c.params == nil {
		c.params = url.Values{}
	}
	if param, ok := c.params[key]; ok {
		c.params[key] = append(param, fmt.Sprint(value))
	} else {
		c.params[key] = []string{fmt.Sprint(value)}
	}
	return c
}
func (c *Client) Params(values url.Values) *Client {
	c.params = values
	return c
}
func (c *Client) Body(data interface{}) *Client {
	switch t := data.(type) {
	case string:
		c.Req.Body = ioutil.NopCloser(bytes.NewBufferString(t))
		c.Req.ContentLength = int64(len(t))
		return c
	case []byte:
		c.Req.Body = ioutil.NopCloser(bytes.NewBuffer(t))
		c.Req.ContentLength = int64(len(t))
		return c
	case uint, uint8, uint16, uint32, uint64:
	case int, int8, int16, int32, int64:
	case float32, float64:
	default:
		return c
	}
	v := fmt.Sprint(data)
	c.Req.Body = ioutil.NopCloser(bytes.NewBufferString(v))
	c.Req.ContentLength = int64(len(v))
	return c
}
func (c *Client) JSONBody(obj interface{}) *Client {
	_, err := c.JSONBodyWithError(obj)
	if err != nil {
		c.err = err
		return c
	}
	return c
}
func (c *Client) JSONBodyWithError(obj interface{}) (*Client, error) {
	if c.Req.Body == nil && obj != nil {
		data, err := json.Marshal(obj)
		if err != nil {
			return c, err
		}
		c.BodyWithContentType(data, "application/json")
	}
	return c, nil
}
func (c *Client) XMLBody(obj interface{}) *Client {
	_, err := c.XMLBodyWithError(obj)
	if err != nil {
		c.err = err
		return c
	}
	return c
}
func (c *Client) XMLBodyWithError(obj interface{}) (*Client, error) {
	if c.Req.Body == nil && obj != nil {
		data, err := xml.Marshal(obj)
		if err != nil {
			return c, err
		}
		c.BodyWithContentType(data, "application/xml")
	}
	return c, nil
}
func (c *Client) YAMLBody(obj interface{}) *Client {
	_, err := c.YAMLBodyWithError(obj)
	if err != nil {
		c.err = err
		return c
	}
	return c
}
func (c *Client) YAMLBodyWithError(obj interface{}) (*Client, error) {
	if c.Req.Body == nil && obj != nil {
		data, err := yaml.Marshal(obj)
		if err != nil {
			return c, err
		}
		c.BodyWithContentType(data, "application/x+yaml")
	}
	return c, nil
}
func (c *Client) BodyWithContentType(data []byte, contentType string) *Client {
	if c.Req.Body == nil && data != nil && len(data) > 0 {
		c.Req.Body = ioutil.NopCloser(bytes.NewReader(data))
		c.Req.ContentLength = int64(len(data))
		c.Req.Header.Set("Content-Type", contentType)
	}
	return c
}
func (c *Client) Error() error {
	if c.err != nil {
		return c.err
	}
	return nil
}
func (c *Client) HasError() bool {
	return c.err != nil
}
func (c *Client) OK() bool {
	if c.resp == nil {
		c.Bytes()
	}
	return c.err == nil && c.resp != nil && c.resp.StatusCode == http.StatusOK
}
func (c *Client) String() (string, error) {
	data, err := c.Bytes()
	if err != nil {
		return "", err
	}
	return string(data), nil
}
func (c *Client) Result(v interface{}) error {
	data, err := c.Bytes()
	if err != nil {
		return err
	}
	contentType := c.resp.Header.Get("Content-Type")
	if contentType == "" || strings.HasPrefix(contentType, "application/json") {
		return json.Unmarshal(data, v)
	} else if strings.HasPrefix(contentType, "application/xml") {
		return xml.Unmarshal(data, v)
	} else if strings.HasPrefix(contentType, "application/x+yaml") {
		return yaml.Unmarshal(data, v)
	}
	return json.Unmarshal(data, v)
}
func (c *Client) ToJSON(v interface{}) error {
	data, err := c.Bytes()
	if err != nil {
		return err
	}
	return json.Unmarshal(data, v)
}
func (c *Client) ToMap(v *map[string]interface{}) error {
	data, err := c.Bytes()
	if err != nil {
		return err
	}
	return json.Unmarshal(data, v)
}
func (c *Client) ToXML(v interface{}) error {
	data, err := c.Bytes()
	if err != nil {
		return err
	}
	return xml.Unmarshal(data, v)
}
func (c *Client) ToYAML(v interface{}) error {
	data, err := c.Bytes()
	if err != nil {
		return err
	}
	return yaml.Unmarshal(data, v)
}
func (c *Client) ToFile(filename string) error {
	_, err := c.getResponse()
	if err != nil {
		return err
	}
	if c.resp.Body == nil {
		return nil
	}
	defer c.resp.Body.Close()
	c.bodyClose = true
	err = pathExistAndMkdir(filename)
	if err != nil {
		return err
	}
	f, err := os.Create(filename)
	if err != nil {
		return err
	}
	defer f.Close()
	_, err = io.Copy(f, c.resp.Body)
	return err
}
func pathExistAndMkdir(filename string) (err error) {
	filename = path.Dir(filename)
	_, err = os.Stat(filename)
	if err == nil {
		return nil
	}
	if os.IsNotExist(err) {
		err = os.MkdirAll(filename, os.ModePerm)
		if err == nil {
			return nil
		}
	}
	return err
}
func (c *Client) Bytes() ([]byte, error) {
	if c.body != nil {
		return c.body, nil
	}
	_, err := c.getResponse()
	if err != nil {
		return nil, err
	}
	if c.resp.Body == nil {
		return nil, errors.New("empty body")
	}
	defer c.resp.Body.Close()
	c.bodyClose = true
	if c.resp.Header.Get("Content-Encoding") == "gzip" {
		reader, err := gzip.NewReader(c.resp.Body)
		if err != nil {
			return nil, err
		}
		c.body, err = ioutil.ReadAll(reader)
		return c.body, err
	}
	c.body, err = ioutil.ReadAll(c.resp.Body)
	return c.body, err
}
func (c *Client) getResponse() (*http.Response, error) {
	if c.resp != nil {
		return c.resp, nil
	}
	if c.resp == nil {
		r, err := c.Do()
		if err == nil {
			return r, nil
		}
		return nil, err
	}
	return nil, errors.New("empty response")
}
func Get(url string) *Client {
	return createRequest(url, http.MethodGet)
}