http

package
v1.18.1 Latest Latest
Warning

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

Go to latest
Published: May 23, 2024 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 3 more Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Optional

func Optional(req *restful.Request, key, defaultVal string) string

func ParseJsonBody

func ParseJsonBody(req *restful.Request, value interface{}) error

ParseJsonBody parse http body as json object

func ParseQueryParams

func ParseQueryParams(req *restful.Request) map[string]string

ParseQueryParams 解析并获取HTTP的query params

func Required

func Required(req *restful.Request, key string) (string, error)

func RequiredInt

func RequiredInt(req *restful.Request, key string) (int, error)

func WrirteNacosErrorResponse

func WrirteNacosErrorResponse(data error, resp *restful.Response)

WrirteNacosErrorResponse .

func WrirteNacosResponse

func WrirteNacosResponse(data interface{}, resp *restful.Response)

WrirteNacosResponse .

func WrirteNacosResponseWithCode

func WrirteNacosResponseWithCode(code int, data interface{}, resp *restful.Response)

WrirteNacosResponseWithCode .

func WrirteSimpleResponse

func WrirteSimpleResponse(data string, code int, resp *restful.Response)

WrirteSimpleResponse .

Types

type Handler

type Handler struct {
	Request  *restful.Request
	Response *restful.Response
}

Handler HTTP请求/回复处理器

func (*Handler) ParseHeaderContext

func (h *Handler) ParseHeaderContext() context.Context

ParseHeaderContext 将http请求header中携带的用户信息提取出来

Jump to

Keyboard shortcuts

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