Documentation ¶
Index ¶
- Constants
- Variables
- func AddPathToURL(surl, add string) string
- func ArgsFromURL(u *url.URL) map[string]string
- func CheckErrorFromBody(resp *http.Response) (err error)
- func Get(surl string, params Parameters, receive any) (resp *http.Response, err error)
- func GetAndReturnUrlEncodedBodyValues(surl string) (values url.Values, err error)
- func GetContentLengthFromHeader(header http.Header) (int64, error)
- func GetCopyOfRequestBodyAsString(req *http.Request) string
- func GetCopyOfResponseBodyAsString(resp *http.Response) string
- func GetHeaders(surl string) (header http.Header, err error)
- func GetIPAddressAndPortFromRequest(req *http.Request) (ip, port string, err error)
- func GetRedirectedURL(surl string) (string, error)
- func GetResponse(surl string, params Parameters) (resp *http.Response, err error)
- func GetResponseFromReqClient(params Parameters, request *http.Request, client *http.Client) (resp *http.Response, err error)
- func HasURLScheme(str string) bool
- func HostIsLocal(host string) bool
- func IsRuneValidForHeaderKey(r rune) bool
- func MakeDataURL(data []byte, mime string) string
- func MakeHTTPError(err error, code int, message string) error
- func MakeRequest(surl string, params Parameters) (request *http.Request, client *http.Client, err error)
- func MakeURLWithArgs(surl string, args map[string]string) (string, error)
- func Post(surl string, params Parameters, send, receive any) (resp *http.Response, err error)
- func Put(surl string, params Parameters, send, receive any) (resp *http.Response, err error)
- func ReceiveToFile(req *http.Request, toPath string, inTemp bool) (path string, err error)
- func ReplaceURLsInText(text string, f func(surl string) string) string
- func SendBody(surl string, params Parameters, send, receive any) (*http.Response, error)
- func SendBytesOrFromReader(surl string, params Parameters) (resp *http.Response, code int, err error)
- func SendForFile(surl string, crc, length int64, params Parameters) error
- func StringStartsWithHTTPX(str string) bool
- func TruncateLongParametersInURL(surl string, onlyIfTotalCharsMoreThan, maxCharsInParameter int) string
- func ValsFromURL(surl string) url.Values
- type ErrJSON
- type ErrorStruct
- type GetInfo
- type HTTPError
- type Parameters
- type SSENotificationCenter
Constants ¶
View Source
const DefaultTimeoutSeconds = 15
Variables ¶
View Source
var NoVerifyClient = &http.Client{ Timeout: 15 * time.Second, Transport: &http.Transport{ TLSClientConfig: &tls.Config{ InsecureSkipVerify: true, }, }, }
View Source
var (
SetTelemetryForRedirectFunc func(surl string, secs float64)
)
Functions ¶
func AddPathToURL ¶
func ArgsFromURL ¶
ArgsFromURL gets Query arguments from a url. It can only store k/v of first unqiue key
func CheckErrorFromBody ¶
func GetRedirectedURL ¶
func GetResponse ¶
func GetResponse(surl string, params Parameters) (resp *http.Response, err error)
func HasURLScheme ¶
func HostIsLocal ¶
func IsRuneValidForHeaderKey ¶
func MakeDataURL ¶
func MakeRequest ¶
func ReceiveToFile ¶
ReceiveToFile receives a file as a POST body, to path or temporary file. The file's crc and length are calculated and compared with values sent with SendForFile()
func SendBody ¶
SendBody uses send as []byte, map[string]string (to url parameters, or unmarshals to use as body) receive can be []byte, string or a struct to unmarashal to
func SendBytesOrFromReader ¶
func SendForFile ¶
func SendForFile(surl string, crc, length int64, params Parameters) error
SendForFile POSTs parameter.Body or parameter.Reader to surl, with crc and Content-Length headers. If crc or length are 0, they are calculated, reading params.Reader into params.Body if needed.
func StringStartsWithHTTPX ¶
func ValsFromURL ¶
Types ¶
type ErrorStruct ¶
type ErrorStruct struct { Type string `json:"type"` ObjectType string `json:"objectType"` Code json.RawMessage `json:"code"` Message string `json:"message"` }
func (ErrorStruct) Check ¶
func (e ErrorStruct) Check(err *error) bool
type GetInfo ¶
type Parameters ¶
type Parameters struct { Headers map[string]string SkipVerifyCertificate bool PrintBody bool Args map[string]string TimeoutSecs float64 UseHTTPS bool Method string ContentType string Body []byte Reader io.Reader GetErrorFromBody bool Context context.Context }
func MakeParameters ¶
func MakeParameters() Parameters
type SSENotificationCenter ¶
type SSENotificationCenter struct {
// contains filtered or unexported fields
}
func SetupSSE ¶
func SetupSSE(pathWithPort string) *SSENotificationCenter
func (*SSENotificationCenter) NotifyWithJson ¶
func (nc *SSENotificationCenter) NotifyWithJson(v interface{}) error
Click to show internal directories.
Click to hide internal directories.