httputil

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllowMethod

func AllowMethod(expect string, got string) bool

AllowMethod check if http method of request is allow

func BindBody

func BindBody(c echo.Context, d interface{}) error

BindBody bind gin body

func BodyToQuery

func BodyToQuery(data string) string

BodyToQuery convert a JSON body to http GET query parameter

func DoPoxy

func DoPoxy(ctx context.Context, req *permit.Request, p *Proxys, modify ModifyResponse) error

func GetRequestArgs

func GetRequestArgs(c echo.Context, d interface{}) error

GetRequestArgs get request args

func HTTPRequest

func HTTPRequest(reqURL, method, data string, header http.Header, owner string) (string, *http.Response, error)

HTTPRequest implements general http request methods, and return the response string body BUG: return (string, http.Header, error) run fail

func IsQueryMethod

func IsQueryMethod(method string) bool

IsQueryMethod check if http method is query

func MakeRefer

func MakeRefer(req *http.Request) string

MakeRefer get refer from request

func ObjectBodyToQuery

func ObjectBodyToQuery(d interface{}) string

ObjectBodyToQuery convert a JSON body to http GET query parameter

func QueryToBody

func QueryToBody(query url.Values, pretty bool) string

QueryToBody convert query to body json

func Transport

func Transport(conf *config.Config) *http.Transport

Transport Transport

Types

type ModifyResponse

type ModifyResponse func(*http.Response) error

type Proxys

type Proxys struct {
	Url       *url.URL
	Transport http.RoundTripper
}

Jump to

Keyboard shortcuts

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