httpHelper

package
v0.0.0-...-08474b0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2024 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddAuthorInfo

func AddAuthorInfo(req domain.BaseRequest, request *http.Request)

func Base64

func Base64(str string) (ret string)

func DecodeResponseBody

func DecodeResponseBody(resp *http.Response) (err error)

func GenUrl

func GenUrl(server string, path string) string

func GetCookies

func GetCookies(cookies []*http.Cookie, jarCookies []*http.Cookie) (ret []domain.ExecCookie)

func GetHeaders

func GetHeaders(header http.Header) (headers []domain.Header)

func IsFormBody

func IsFormBody(bodyType consts.HttpContentType) bool

func IsFormUrlencodedBody

func IsFormUrlencodedBody(bodyType consts.HttpContentType) bool

func IsHtmlContent

func IsHtmlContent(str string) bool

func IsImageContent

func IsImageContent(str string) bool

func IsJsonBody

func IsJsonBody(bodyType consts.HttpContentType) bool

func IsJsonContent

func IsJsonContent(str string) bool

func IsJsonResp

func IsJsonResp(resp domain.DebugResponse) (ret bool)

func IsJsonRespType

func IsJsonRespType(typ consts.HttpContentType) (ret bool)

func IsStreamResponse

func IsStreamResponse(contentType consts.HttpContentType) bool

func IsXmlContent

func IsXmlContent(str string) bool

func MultipartContentType

func MultipartContentType(w *TFormDataWriter) string

func UpdateUrl

func UpdateUrl(url string) string

func WrapperErrInResp

func WrapperErrInResp(code int, statusContent string, content string, resp *domain.DebugResponse)

Types

type Request

type Request struct {
	PageSize int `json:"pageSize"`
	PageNo   int `json:"pageNo"`
	Aa       int `json:"aa"`
}

type Response

type Response struct {
	Code    int         `json:"code"`
	Type    string      `json:"type"`
	Message interface{} `json:"message"`
	Result  interface{} `json:"result"`
}

type TFormDataWriter

type TFormDataWriter struct {
	Writer  *multipart.Writer
	Payload *bytes.Buffer
}

func MultipartEncoder

func MultipartEncoder(bodyFormData []domain.BodyFormDataItem) (tFormWriter *TFormDataWriter, err error)

Jump to

Keyboard shortcuts

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