Documentation
¶
Index ¶
- Variables
- func DumpConfig(c interface{}) string
- func FileExists(path string) bool
- func FormRedirectUrl(old string, redirect string) (string, error)
- func FormURL(server, path string) string
- func GetHttpClientDebugMode() bool
- func GetIPList() []string
- func HasFlag(name string) bool
- func HasQueryParam(req *http.Request, param string) (bool, error)
- func JoinURL(p1, p2 string) string
- func LoadJsonConfig(path string, c interface{}) error
- func MaxInt(a, b int) int
- func MinInt(a, b int) int
- func ParseJsonRequest(r *http.Request, out interface{}) error
- func QueryParam(req *http.Request, param string) (string, error)
- func SetHttpClientDebugMode(flag bool)
- func SplitListArg(arg string, seperator string) []string
- func WriteErrorResponse(w http.ResponseWriter, statusCode int, err error)
- func WriteSuccessResponse(w http.ResponseWriter)
- func WriteSuccessResponseWithData(w http.ResponseWriter, data interface{})
- type GenericJsonResp
- type HttpClient
- func (c *HttpClient) Do(req *http.Request) (*http.Response, error)
- func (c *HttpClient) DoGetAndParseResult(url string, result interface{}) error
- func (c *HttpClient) DoJsonPost(url string, data interface{}) (*http.Response, error)
- func (c *HttpClient) DoJsonPostAndParseResult(url string, data interface{}, result interface{}) error
- func (c *HttpClient) DoRequestParseResult(method, url string, result interface{}) error
- func (c *HttpClient) DumpRequest(req *http.Request, w io.Writer)
- func (c *HttpClient) DumpResponse(resp *http.Response, w io.Writer)
- func (c *HttpClient) ParseJsonResp(resp *http.Response, result interface{}) error
- type HttpClientConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrParamNotFound = errors.New("param not found")
)
Functions ¶
func DumpConfig ¶
func DumpConfig(c interface{}) string
func FileExists ¶
func GetHttpClientDebugMode ¶
func GetHttpClientDebugMode() bool
func LoadJsonConfig ¶
func ParseJsonRequest ¶
func SetHttpClientDebugMode ¶
func SetHttpClientDebugMode(flag bool)
func SplitListArg ¶
func WriteErrorResponse ¶
func WriteErrorResponse(w http.ResponseWriter, statusCode int, err error)
func WriteSuccessResponse ¶
func WriteSuccessResponse(w http.ResponseWriter)
func WriteSuccessResponseWithData ¶
func WriteSuccessResponseWithData(w http.ResponseWriter, data interface{})
Types ¶
type GenericJsonResp ¶
type HttpClient ¶
type HttpClient struct {
// contains filtered or unexported fields
}
var DefaultHttpClient *HttpClient
func NewHttpClient ¶
func NewHttpClient(cfg *HttpClientConfig) (*HttpClient, error)
func (*HttpClient) DoGetAndParseResult ¶
func (c *HttpClient) DoGetAndParseResult(url string, result interface{}) error
func (*HttpClient) DoJsonPost ¶
func (c *HttpClient) DoJsonPost(url string, data interface{}) (*http.Response, error)
func (*HttpClient) DoJsonPostAndParseResult ¶
func (c *HttpClient) DoJsonPostAndParseResult(url string, data interface{}, result interface{}) error
func (*HttpClient) DoRequestParseResult ¶
func (c *HttpClient) DoRequestParseResult(method, url string, result interface{}) error
func (*HttpClient) DumpRequest ¶
func (c *HttpClient) DumpRequest(req *http.Request, w io.Writer)
func (*HttpClient) DumpResponse ¶
func (c *HttpClient) DumpResponse(resp *http.Response, w io.Writer)
func (*HttpClient) ParseJsonResp ¶
func (c *HttpClient) ParseJsonResp(resp *http.Response, result interface{}) error
Source Files
¶
Click to show internal directories.
Click to hide internal directories.