MCPcopy Index your code

hub / github.com/cizixs/gohttp / functions

Functions67 in github.com/cizixs/gohttp

↓ 42 callersMethodNew
New clones current client struct and returns it This is useful to initialize some common parameters and send different requests with differenet paths/
gohttp.go:193
↓ 20 callersMethodGet
Get handles HTTP GET request, and return response to user Note that the response is not `http.Response`, but a thin wrapper which does exactly what it
gohttp.go:458
↓ 7 callersMethodDo
Do takes HTTP and url, then makes the request, return the response. All other HTTP methods will call `Do` behind the scene, and it can be used directl
gohttp.go:403
↓ 7 callersMethodPost
Post handles HTTP POST request
gohttp.go:463
↓ 6 callersMethodHeader
Header sets request header data
gohttp.go:588
↓ 6 callersMethodlogf
log writes a formatted log message record to Stderr
gohttp.go:226
↓ 5 callersMethodBody
Body accepts `io.Reader`, will read data from it and use it as request body. This doee not set `Content-Type` header, so users should use `Header(key,
gohttp.go:664
↓ 5 callersMethodPath
Path concatenates base url with resource path. Path can be with or without slash `/` at both end, it will be handled properly. Usage: gohttp.New().Pa
gohttp.go:509
↓ 5 callersMethodQuery
Query set parameter query string
gohttp.go:568
↓ 3 callersMethodURL
URL sets the base url for the client, this can be overrided by the parameter of the final GET/POST/PUT method
gohttp.go:495
↓ 2 callersMethodAsBytes
AsBytes return the response body as byte slice An error will be returned if the body can not be read as bytes
gohttp.go:67
↓ 2 callersMethodDelete
Delete handles HTTP DELETE request
gohttp.go:479
↓ 2 callersMethodHead
Head handles HTTP HEAD request HEAD request works the same way as GET, except the response body is empty.
gohttp.go:469
↓ 2 callersMethodJSON
JSON accepts a string as data, and sets it as body, and send it as application/json If the actual method does not support body or json data, such as `
gohttp.go:609
↓ 2 callersMethodOptions
Options handles HTTP OPTIONS request
gohttp.go:489
↓ 2 callersMethodPatch
Patch handles HTTP PATCH request
gohttp.go:484
↓ 2 callersMethodPut
Put handles HTTP PUT request
gohttp.go:474
↓ 2 callersMethodTimeout
Timeout sets the wait limit for a request to finish. This time includes connection time, redirectoin time, and read response body time. If request doe
gohttp.go:538
↓ 2 callersFunctioncopyMap
(src map[string]string)
gohttp.go:172
↓ 1 callersMethodAsJSON
AsJSON parses response body to a struct Usage: user := &User{} resp.AsJSON(user) fmt.Printf("%s\n", user.Name)
gohttp.go:76
↓ 1 callersMethodAsString
AsString returns the response data as string An error wil bw returned if the body can not be read as string
gohttp.go:57
↓ 1 callersMethodCookie
Cookie set client cookie, the argument is a standard `http.Cookie`
gohttp.go:560
↓ 1 callersMethodFile
File adds a file in request body, and sends it to server Multiple files can be added by calling this method many times
gohttp.go:673
↓ 1 callersMethodForm
Form accepts a struct, uses it as body data, and sent it as application/www-x-form-urlencoded If the actual method does not support body or form data,
gohttp.go:652
↓ 1 callersMethodJSONStruct
JSONStruct accepts a struct as data, and sets it as body, and send it as application/json If the actual method does not support body or json data, suc
gohttp.go:623
↓ 1 callersFunctionNew
New returns a new GoClient with default values
gohttp.go:153
↓ 1 callersMethodQueryStruct
QueryStruct parses a struct as query strings On how it works, please refer to github.com/google/go-querystring repo
gohttp.go:575
↓ 1 callersMethodRetries
Retries set how many request attempts will be conducted if error happens for a request. number <= 1 means no retries, send one request and finish.
gohttp.go:553
↓ 1 callersMethodprepareFiles
()
gohttp.go:262
↓ 1 callersMethodprepareRequest
prepareRequest does all the preparation jobs for `gohttp`. The main job is create and configure all structs like `Transport`, `Dialer`, `Client` accor
gohttp.go:306
↓ 1 callersMethodsetupClient
setupClient handles the connection details from http client to TCP connections. Timeout, proxy, TLS config ..., these are very important but rarely us
gohttp.go:235
MethodBasicAuth
BasicAuth allows simple username/password authentication
gohttp.go:581
MethodBody
()
gohttp.go:597
MethodBody
Body returns io.Reader from form data. Form data is a collection of many key-value pairs, so we use go-querystring to parse it to string, then create
gohttp.go:641
MethodDebug
Debug sets the debug mode of go http. By default, debug mode is off. This is only for testing and debugging purpose, it will print out detail informa
gohttp.go:392
FunctionDelete
Delete provides a shortcut to send `DELETE` request It is used to remove a resource from server
gohttp.go:695
FunctionGet
Get provides a shortcut to send `GET` request
gohttp.go:684
FunctionHead
Head provides a shortcut to send `HEAD` request
gohttp.go:689
FunctionOptions
Options provides a shortcut to send `OPTIONS` request
gohttp.go:700
FunctionPatch
Patch provides a shortcut to send `PATCH` request
gohttp.go:715
FunctionPost
Post provides a shortcut to send `POST` request
gohttp.go:705
MethodProxy
Proxy sets proxy server the client uses. If it is empty, `gohttp` will try to load proxy settings from environment variable Usage: gohttp.New().Proxy
gohttp.go:524
FunctionPut
Put provides a shortcut to send `PUT` request
gohttp.go:710
MethodTLSHandshakeTimeout
TLSHandshakeTimeout sets the wait limit for performing TLS handshake. Default value for go1.6 is 10s, change this value to suit yourself.
gohttp.go:546
FunctionTestCloneClient
(t *testing.T)
gohttp_test.go:37
FunctionTestCookie
(t *testing.T)
gohttp_test.go:226
FunctionTestDelete
(t *testing.T)
gohttp_test.go:126
FunctionTestGet
(t *testing.T)
gohttp_test.go:20
FunctionTestGetWithHeader
(t *testing.T)
gohttp_test.go:334
FunctionTestGetWithPath
(t *testing.T)
gohttp_test.go:258
FunctionTestGetWithQuery
(t *testing.T)
gohttp_test.go:295
FunctionTestGetWithQueryStruct
(t *testing.T)
gohttp_test.go:314
FunctionTestGetWithURL
(t *testing.T)
gohttp_test.go:242
FunctionTestHead
(t *testing.T)
gohttp_test.go:111
FunctionTestOptions
(t *testing.T)
gohttp_test.go:168
FunctionTestPatch
(t *testing.T)
gohttp_test.go:154
FunctionTestPost
(t *testing.T)
gohttp_test.go:140
FunctionTestPostFiles
(t *testing.T)
gohttp_test.go:444
FunctionTestPostForm
(t *testing.T)
gohttp_test.go:350
FunctionTestPostJSON
(t *testing.T)
gohttp_test.go:380
FunctionTestPostJSONStruct
(t *testing.T)
gohttp_test.go:409
FunctionTestPut
(t *testing.T)
gohttp_test.go:182
FunctionTestResponseAsBytes
(t *testing.T)
gohttp_test.go:73
FunctionTestResponseAsJSON
(t *testing.T)
gohttp_test.go:91
FunctionTestResponseAsString
(t *testing.T)
gohttp_test.go:55
FunctionTestRetries
(t *testing.T)
gohttp_test.go:208
FunctionTestTimeout
(t *testing.T)
gohttp_test.go:196