httpHelper

package
v0.0.0-...-77e6e3b Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Logger *zap.Logger

Functions

func Base64

func Base64(str string) (ret string)

func Connect

func Connect(req domain.BaseRequest) (ret domain.DebugResponse, err error)

func Delete

func Delete(req domain.BaseRequest) (
	ret domain.DebugResponse, err error)

func GenBodyFormData

func GenBodyFormData(req domain.BaseRequest) (formData []domain.BodyFormDataItem)

func GenBodyFormDataFromItems

func GenBodyFormDataFromItems(items *[]domain.BodyFormDataItem) (formData []domain.BodyFormDataItem)

func GenBodyFormUrlencoded

func GenBodyFormUrlencoded(req domain.BaseRequest) (ret string)

func GenBodyFormUrlencodedFromItems

func GenBodyFormUrlencodedFromItems(items *[]domain.BodyFormUrlEncodedItem) (ret string)

func GenUrl

func GenUrl(server string, path string) string

func Get

func Get(req domain.BaseRequest) (ret domain.DebugResponse, err error)
func Head(req domain.BaseRequest) (ret domain.DebugResponse, err error)

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 IsXmlContent

func IsXmlContent(str string) bool

func MultipartContentType

func MultipartContentType(w *TFormDataWriter) string

func Options

func Options(req domain.BaseRequest) (ret domain.DebugResponse, err error)

func Patch

func Patch(req domain.BaseRequest) (
	ret domain.DebugResponse, err error)

func Post

func Post(req domain.BaseRequest) (
	ret domain.DebugResponse, err error)

func Put

func Put(req domain.BaseRequest) (
	ret domain.DebugResponse, err error)

func Trace

func Trace(req domain.BaseRequest) (ret domain.DebugResponse, err error)

func UpdateUrl

func UpdateUrl(url string) string

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