PTGUhttp

package
v1.0.17 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 8, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Request Type
	TypeJSON           = "json"
	TypeFormURLEncoded = "form"
)

Variables

This section is empty.

Functions

func ParseJsonResponseToStruct

func ParseJsonResponseToStruct(param ParamParseJsonResponseToStruct) (err error)

Types

type ParamBasicAuth added in v1.0.12

type ParamBasicAuth struct {
	Username string
	Password string
}

type ParamHTTPRequest

type ParamHTTPRequest struct {
	Type           string `json:"type" validate:"required,oneof=json form"`
	Method         string `json:"method" validate:"required,oneof=GET POST PUT PATCH DELETE"`
	URL            string `json:"url" validate:"required,http_url"`
	Query          map[string]string
	BasicAuth      ParamBasicAuth
	Headers        map[string]string
	Body           interface{}
	RequestTimeout time.Duration
}

type ParamParseJsonResponseToStruct

type ParamParseJsonResponseToStruct struct {
	ResponseBody   []byte
	ResponseStruct interface{}
}

type ReturnHTTPRequest

type ReturnHTTPRequest struct {
	StatusText    string
	StatusCode    int
	Proto         string
	ContentLength int64
	Header        http.Header
	ResponseBody  []byte
}

func HTTPRequest

func HTTPRequest(param ParamHTTPRequest) (returnData ReturnHTTPRequest, err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL