version

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package version 提供一个限定版本号的中间件

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(next http.Handler, v string, strict bool) http.Handler

New 构建一个限定版本号的中间件

从请求报头的 Accept 中解析相应的版本号,不区分大小写。

当版本号不匹配时,返回 404 错误信息。

v 只有与此匹配的版本号,才能运行 h; strict 在没有指定版本号时的处理方式,为 false 时,请求头无版本号 表示可以匹配;为 true 时,请求头无版本号表示不匹配。

若要将版本号放在路径中,可以直接使用 https://github.com/issue9/mux.Prefix 对象

Types

This section is empty.

Jump to

Keyboard shortcuts

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