middleware

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2018 License: MIT Imports: 1 Imported by: 1

README

middleware Build Status

middleware 是实现 http.Handler 接口的中间件,提供了大部分实用的功能。

  • version 匹配从 Accept 报头中的版本号信息;
  • comporess 对内容进行压缩;
  • host 匹配指定的域名;
  • recovery 对 Panic 的处理;
  • header 输出指定的报头;
安装
go get github.com/issue9/middleware
文档

Go Walker GoDoc

版权

本项目采用 MIT 开源授权许可证,完整的授权说明可在 LICENSE 文件中找到。

Documentation

Overview

Package middleware 包含了一系列 http.Handler 接口的中间件。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler(h http.Handler, middleware ...Middleware) http.Handler

Handler 将所有的中间件应用于 h。

func HandlerFunc

func HandlerFunc(h func(w http.ResponseWriter, r *http.Request), middleware ...Middleware) http.Handler

HandlerFunc 将所有的中间件应用于 h。

Types

type Middleware

type Middleware func(http.Handler) http.Handler

Middleware 将一个 http.Handler 封装成另一个 http.Handler

Directories

Path Synopsis
Package compress 提供一个支持内容压缩的中间件。
Package compress 提供一个支持内容压缩的中间件。
accept
Package accept 用于处理 accpet 系列的报头。
Package accept 用于处理 accpet 系列的报头。
Package header 用于指定输出的报头。
Package header 用于指定输出的报头。
Package host 提供了限定访问域名的中间件。
Package host 提供了限定访问域名的中间件。
Package ratelimit 提供了 X-Rate-Limit 功能的中间件: store := NewMemory(...) srv := NewServer(store) h = srv.RateLimit(h, logs.ERROR())
Package ratelimit 提供了 X-Rate-Limit 功能的中间件: store := NewMemory(...) srv := NewServer(store) h = srv.RateLimit(h, logs.ERROR())
Package recovery 提供了处理 panic 操作的中间件。
Package recovery 提供了处理 panic 操作的中间件。
Package version 提供一个限定版本号的中间件。
Package version 提供一个限定版本号的中间件。

Jump to

Keyboard shortcuts

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