httptool

package
v0.0.0-...-d07672d Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2023 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HttpRequestOkCode    int64 = 0
	HttpRequestErrorCode int64 = iota + 10
)
View Source
const (
	ConstHttpHeaderContentType                = "Content-Type"
	ConstHttpHeaderJsonContentTypeValue       = binding.MIMEJSON
	ConstHttpHeaderXmlContentTypeValue        = binding.MIMEXML
	ConstHttpHeaderXml2ContentTypeValue       = binding.MIMEXML2
	ConstHttpHeaderYamlContentTypeValue       = binding.MIMEYAML
	ConstHttpHeaderTomlContentTypeValue       = binding.MIMETOML
	ConstHttpHeaderTextContentTypeValue       = binding.MIMEPlain
	ConstHttpHeaderJavascriptContentTypeValue = "application/javascript"
)
View Source
const (
	HttpRequestOk = "success"
)

Variables

This section is empty.

Functions

func CalcRequestSize

func CalcRequestSize(r *http.Request) int64

CalcRequestSize返回请求(request)对象的大小

func CanRecordContextBody

func CanRecordContextBody(h http.Header) bool

CanRecordContextBody 检查HTTP请求头中是否存在特定内容类型的值。

func ExtContextTypeToUTF8

func ExtContextTypeToUTF8(s string) string

func HttpHandlerFuncToGinHandlerFunc

func HttpHandlerFuncToGinHandlerFunc(handler http.HandlerFunc) gin.HandlerFunc

HttpHandlerFuncToGinHandlerFunc 将标准的 http.HandlerFunc 包装为 gin.HandlerFunc

func HttpHandlerToGinHandlerFunc

func HttpHandlerToGinHandlerFunc(handler http.Handler) gin.HandlerFunc

HttpHandlerToGinHandlerFunc 将标准的 http.Handler 包装为 gin.HandlerFunc

func StringFilterFlags

func StringFilterFlags(content string) string

StringFilterFlags 返回给定字符串中第一个标记。

Types

type BaseHttpResponse

type BaseHttpResponse struct {
	Code         int64       `json:"errorCode" yaml:"errorCode"`                           // 响应代码
	ErrorMessage string      `json:"errorMessage,omitempty" yaml:"errorMessage,omitempty"` // 错误信息
	ErrorDetail  interface{} `json:"errorDetail,omitempty" yaml:"errorDetail,omitempty"`   // 错误详细信息
	Data         interface{} `json:"data,omitempty" yaml:"data,omitempty"`                 // 响应数据
}

type HttpQueryPaginated

type HttpQueryPaginated struct {
	PageIndex uint32 `json:"pageIndex" yaml:"pageIndex"` // 当前页数量
	PageSize  uint32 `json:"pageSize" yaml:"pageSize"`   // 每页显示最大条目数
	Desc      bool   `json:"desc" yaml:"desc"`           // 是否倒序
}

type HttpResponseItemsID

type HttpResponseItemsID struct {
	ID int64 `json:"id" yaml:"id"` // 响应对象 Id
}

type HttpResponseItemsTotal

type HttpResponseItemsTotal struct {
	TotalCount int64 `json:"totalCount" yaml:"totalCount"` // 响应对象总数
}

type HttpResponsePaginated

type HttpResponsePaginated struct {
	HttpResponseItemsTotal
	HttpQueryPaginated
	BaseHttpResponse
}

HttpResponsePaginated 匿名对象后面不需要 json 相关的描述,就回平铺结构

Jump to

Keyboard shortcuts

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