handlers

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handlers

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

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

func New

func New(disableOptions bool) *Handlers

New 声明一个新的 Handlers 实例

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