{"modulePath":"github.com/developerspl/gogs","version":"v0.5.2","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package httplib\n\n## Functions\n\n```go\nfunc SetDefaultSetting(setting BeegoHttpSettings)\n```\nOverwrite default settings\n\n```go\nfunc TimeoutDialer(cTimeout time.Duration, rwTimeout time.Duration) func(net, addr string) (c net.Conn, err error)\n```\nTimeoutDialer returns functions of connection dialer with timeout settings for http.Transport Dial field.\n\n## Types\n\n```go\ntype BeegoHttpRequest struct {\n\t// contains filtered or unexported fields\n}\n```\nBeegoHttpRequest provides more useful methods for requesting one url than http.Request.\n\n```go\nfunc Delete(url string) *BeegoHttpRequest\n```\nDelete returns \\*BeegoHttpRequest DELETE method.\n\n```go\nfunc Get(url string) *BeegoHttpRequest\n```\nGet returns \\*BeegoHttpRequest with GET method.\n\n```go\nfunc Head(url string) *BeegoHttpRequest\n```\nHead returns \\*BeegoHttpRequest with HEAD method.\n\n```go\nfunc Post(url string) *BeegoHttpRequest\n```\nPost returns \\*BeegoHttpRequest with POST method.\n\n```go\nfunc Put(url string) *BeegoHttpRequest\n```\nPut returns \\*BeegoHttpRequest with PUT method.\n\n```go\nfunc (b *BeegoHttpRequest) Body(data interface{}) *BeegoHttpRequest\n```\nBody adds request raw body. it supports string and \\[]byte.\n\n```go\nfunc (b *BeegoHttpRequest) Bytes() ([]byte, error)\n```\nBytes returns the body \\[]byte in response. it calls Response inner.\n\n```go\nfunc (b *BeegoHttpRequest) Debug(isdebug bool) *BeegoHttpRequest\n```\nDebug sets show debug or not when executing request.\n\n```go\nfunc (b *BeegoHttpRequest) Header(key, value string) *BeegoHttpRequest\n```\nHeader add header item string in request.\n\n```go\nfunc (b *BeegoHttpRequest) Param(key, value string) *BeegoHttpRequest\n```\nParam adds query param in to request. params build query string as ?key1=value1\u0026key2=value2...\n\n```go\nfunc (b *BeegoHttpRequest) PostFile(formname, filename string) *BeegoHttpRequest\n```\n\n```go\nfunc (b *BeegoHttpRequest) Response() (*http.Response, error)\n```\nResponse executes request client gets response mannually.\n\n```go\nfunc (b *BeegoHttpRequest) SetBasicAuth(username, password string) *BeegoHttpRequest\n```\nSetBasicAuth sets the request's Authorization header to use HTTP Basic Authentication with the provided username and password.\n\n```go\nfunc (b *BeegoHttpRequest) SetCookie(cookie *http.Cookie) *BeegoHttpRequest\n```\nSetCookie add cookie into request.\n\n```go\nfunc (b *BeegoHttpRequest) SetEnableCookie(enable bool) *BeegoHttpRequest\n```\nSetEnableCookie sets enable/disable cookiejar\n\n```go\nfunc (b *BeegoHttpRequest) SetProtocolVersion(vers string) *BeegoHttpRequest\n```\nSet the protocol version for incoming requests. Client requests always use HTTP/1.1.\n\n```go\nfunc (b *BeegoHttpRequest) SetProxy(proxy func(*http.Request) (*url.URL, error)) *BeegoHttpRequest\n```\nSet http proxy example:\n\n\tfunc(req *http.Request) (*url.URL, error) {\n\t\tu, _ := url.ParseRequestURI(\"http://127.0.0.1:8118\")\n\t\treturn u, nil\n\t}\n\n```go\nfunc (b *BeegoHttpRequest) SetTLSClientConfig(config *tls.Config) *BeegoHttpRequest\n```\nSetTLSClientConfig sets tls connection configurations if visiting https url.\n\n```go\nfunc (b *BeegoHttpRequest) SetTimeout(connectTimeout, readWriteTimeout time.Duration) *BeegoHttpRequest\n```\nSetTimeout sets connect time out and read-write time out for BeegoRequest.\n\n```go\nfunc (b *BeegoHttpRequest) SetTransport(transport http.RoundTripper) *BeegoHttpRequest\n```\nSet transport to\n\n```go\nfunc (b *BeegoHttpRequest) SetUserAgent(useragent string) *BeegoHttpRequest\n```\nSetUserAgent sets User-Agent header field\n\n```go\nfunc (b *BeegoHttpRequest) Setting(setting BeegoHttpSettings) *BeegoHttpRequest\n```\nChange request settings\n\n```go\nfunc (b *BeegoHttpRequest) String() (string, error)\n```\nString returns the body string in response. it calls Response inner.\n\n```go\nfunc (b *BeegoHttpRequest) ToFile(filename string) error\n```\nToFile saves the body data in response to one file. it calls Response inner.\n\n```go\nfunc (b *BeegoHttpRequest) ToJson(v interface{}) error\n```\nToJson returns the map that marshals from the body bytes as json in response . it calls Response inner.\n\n```go\nfunc (b *BeegoHttpRequest) ToXml(v interface{}) error\n```\nToXml returns the map that marshals from the body bytes as xml in response . it calls Response inner.\n\n```go\ntype BeegoHttpSettings struct {\n\tShowDebug        bool\n\tUserAgent        string\n\tConnectTimeout   time.Duration\n\tReadWriteTimeout time.Duration\n\tTlsClientConfig  *tls.Config\n\tProxy            func(*http.Request) (*url.URL, error)\n\tTransport        http.RoundTripper\n\tEnableCookie     bool\n}\n```\nBeegoHttpSettings\n\n","path":"github.com/developerspl/gogs/modules/httplib","name":"httplib","synopsis":"","isRedistributable":true}
