handlers

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2019 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package handlers 用于处理节点下与处理函数相关的逻辑

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Map

func Map() map[int16]string

Map 返回所有的 methodMap 数据,仅供 make.go 产生数据

Types

type Handlers

type Handlers struct {
	// contains filtered or unexported fields
}

Handlers 用于表示某节点下各个请求方法对应的处理函数。

func New

func New(disableOptions, disableHead bool) *Handlers

New 声明一个新的 Handlers 实例 disableHead 是否自动添加 HEAD 请求内容。

func (*Handlers) Add

func (hs *Handlers) Add(h http.Handler, methods ...string) error

Add 添加一个处理函数

func (*Handlers) Handler

func (hs *Handlers) Handler(method string) http.Handler

Handler 获取指定方法对应的处理函数

func (*Handlers) Len

func (hs *Handlers) Len() int

Len 获取当前支持请求方法数量

func (*Handlers) Options

func (hs *Handlers) Options() string

Options 获取当前支持的请求方法列表字符串

func (*Handlers) Remove

func (hs *Handlers) Remove(methods ...string) bool

Remove 移除某个请求方法对应的处理函数。 返回值表示是否已经被清空。

func (*Handlers) SetAllow

func (hs *Handlers) SetAllow(optionsAllow string)

SetAllow 设置 Options 请求头的 Allow 报头。

Jump to

Keyboard shortcuts

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