accept

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package accept 用于处理 accpet 系列的报头。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Accept

type Accept struct {
	Content string // 完整的内容

	// 解析之后的内容
	Value string
	Q     float32
}

Accept 表示 Accept* 的报头元素

func Parse

func Parse(header string) ([]*Accept, error)

Parse 将报头内容解析为 []*Accept,并对内容进行排序之后返回。

排序方式如下:

Q 值大的靠前,如果 Q 值相同,则全名的比带通配符的靠前,*/* 最后。

q 值为 0 的数据将被过滤,比如:

application/*;q=0.1,application/xml;q=0.1,text/html;q=0

其中的 text/html 不会被返回,application/xml 的优先级会高于 applicatioon/*

Jump to

Keyboard shortcuts

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