Discover Packages
github.com/alibaba/pouch
pkg
httputils
package
Version:
v0.0.0-...-ba854f2
Opens a new window with list of versions in this module.
Published: Aug 22, 2024
License: Apache-2.0
Opens a new window with license information.
Imports: 10
Opens a new window with list of imports.
Imported by: 27
Opens a new window with list of known importers.
Documentation
Documentation
¶
func BoolValue(r *http.Request, k string) bool
func GenTLSConfig(key, cert, ca string) (*tls.Config, error)
func NewHTTPClient(u *url.URL, tlsConfig *tls.Config, dialTimeout, cliTimeout time.Duration) *http.Client
func ParseHost(host string) (*url.URL, string, string, error)
type HTTPError
BoolValue transforms a form value in different formats into a boolean type.
GenTLSConfig returns a tls config object according to inputting parameters.
NewHTTPClient creates a http client using url and tlsconfig
ParseHost inputs a host address string, and output four type:
url.URL, basePath, address without scheme and an error.
type HTTPError struct {
}
HTTPError represents an HTTP error which contains potential status code.
For API layer, daemon side should return error message and using correct status code
to construct response when an error happens in handling requests.
NewHTTPError returns a brand new HTTPError with input message and status code
Code returns status code field of HTTPError
Error returns Message field of HTTPError
Source Files
¶
Click to show internal directories.
Click to hide internal directories.