request

package
v0.0.1-beta Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package request ----------------------------- @author : EndlessShw @time : 2025/9/19 10:34 @Description : Rules.Element 指定的部分,其中 Method 类型过多,因此单独分开 -------------------------------------------

Package request ----------------------------- @author : EndlessShw @time : 2025/9/19 10:48 @Description : Rules.Method 对应部分,供匹配使用 -------------------------------------------

Package request ----------------------------- @author : EndlessShw @time : 2025/9/19 11:00 @Description : 将 yaml 规则文件中的字符串转换成对应的 request.变量 -------------------------------------------

Package request ----------------------------- @author : EndlessShw @time : 2025/9/19 10:57 @Description : 对 yaml 进行多种名称适配 -------------------------------------------

Index

Constants

View Source
const (
	GET       Method = http.MethodGet
	HEAD             = http.MethodHead
	POST             = http.MethodPost
	PUT              = http.MethodPut
	PATCH            = http.MethodPatch
	DELETE           = http.MethodDelete
	CONNECT          = http.MethodConnect
	OPTIONS          = http.MethodOptions
	TRACE            = http.MethodTrace
	ALL              = "ALL"
	UNDEFINED        = ""
)

对常用的 HTTP Method 进行别名,方便 Rule 规则的编写,即规则中的 request.GET 可以转换成代码中的 http.MethodGet

Variables

This section is empty.

Functions

This section is empty.

Types

type Element

type Element int8
const (
	Undefined Element = iota - 1

	// URI 指的是待匹配的 URI(路径和请求参数)
	URI

	Headers

	Body

	Any
)

func ToElement

func ToElement(s string) Element

ToElement 同上

type Method

type Method string

func ToMethod

func ToMethod(s string) Method

ToMethod 将 yaml 规则文件中的 Method 字符串转换成对应的 Method 变量 例如 yaml 配置文件中定义 Method: GET 在代码中就会转换成 (Request.) GET

Jump to

Keyboard shortcuts

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