Documentation ¶
Index ¶
- func CheckRedirect(req *http.Request, via []*http.Request) error
- func CleanOutAllSlashes(t string) string
- func CreateDefaultHttpClient() *http.Client
- func CreateError(w io.Writer, err error, message string, code int) error
- func DoRequest(ctx context.Context, client sabuhp.HttpClient, method string, route string, ...) (*http.Request, *http.Response, error)
- func GetFileMimeType(path string) string
- func LetsEncryptTLS(http2 bool) (*autocert.Manager, *tls.Config)
- func LoadTLS(cert, key string) (*tls.Config, error)
- func ParseAuthorization(val string) (authType string, token string, err error)
- func ParseTokens(val string) ([]string, error)
- func ReduceMultipleSlashTo(t string, replace string) string
- func ReduceMultipleSlashToOne(t string) string
- type CloseErrorChannel
- type ErrorHandler
- type NormalisedReader
- type RequestErr
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanOutAllSlashes ¶
func CreateDefaultHttpClient ¶ added in v0.6.3
func DoRequest ¶
func DoRequest( ctx context.Context, client sabuhp.HttpClient, method string, route string, body io.Reader, headers http.Header, ) (*http.Request, *http.Response, error)
DoRequest makes a request for giving parameters.
func GetFileMimeType ¶
GetFileMimeType returns associated mime type for giving file extension.
func LetsEncryptTLS ¶
LetsEncryptTLS returns a tls.Config instance which retrieves its its tls certificate from LetsEncrypt service.
func ParseAuthorization ¶
ParseAuthorization returns the scheme and token of the Authorization string if it's valid.
func ParseTokens ¶
ParseTokens parses the base64 encoded token sent as part of the Authorization string, It expects all parts of string to be separated with ':', returning split slice.
func ReduceMultipleSlashTo ¶
Types ¶
type CloseErrorChannel ¶
func (*CloseErrorChannel) Close ¶
func (es *CloseErrorChannel) Close()
func (*CloseErrorChannel) Err ¶
func (es *CloseErrorChannel) Err() error
func (*CloseErrorChannel) Group ¶
func (es *CloseErrorChannel) Group() string
func (*CloseErrorChannel) Topic ¶
func (es *CloseErrorChannel) Topic() string
type ErrorHandler ¶
type ErrorHandler struct {
Err error
}
func (*ErrorHandler) Run ¶
func (es *ErrorHandler) Run() error
type NormalisedReader ¶
type NormalisedReader struct {
// contains filtered or unexported fields
}
NormalisedReader reader which normalises line endings "/r" and "/r/n" are converted to "/n"
func NewNormalisedReader ¶
func NewNormalisedReader(r io.Reader) *NormalisedReader
type RequestErr ¶
func (*RequestErr) Error ¶
func (r *RequestErr) Error() string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.