本文整理汇总了Golang中golang.org/x/net/http2.HeadersFrameParam.Priority方法的典型用法代码示例。如果您正苦于以下问题:Golang HeadersFrameParam.Priority方法的具体用法?Golang HeadersFrameParam.Priority怎么用?Golang HeadersFrameParam.Priority使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类golang.org/x/net/http2.HeadersFrameParam
的用法示例。
在下文中一共展示了HeadersFrameParam.Priority方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: StreamDependenciesTestGroup
func StreamDependenciesTestGroup(ctx *Context) *TestGroup {
tg := NewTestGroup("5.3.1", "Stream Dependencies")
tg.AddTestCase(NewTestCase(
"Sends HEADERS frame that depend on itself",
"The endpoint MUST treat this as a stream error of type PROTOCOL_ERROR",
func(ctx *Context) (pass bool, expected []Result, actual Result) {
http2Conn := CreateHttp2Conn(ctx, true)
defer http2Conn.conn.Close()
hdrs := commonHeaderFields(ctx)
var pp http2.PriorityParam
pp.StreamDep = 3
pp.Exclusive = false
pp.Weight = 255
var hp http2.HeadersFrameParam
hp.StreamID = 3
hp.EndStream = true
hp.EndHeaders = true
hp.Priority = pp
hp.BlockFragment = http2Conn.EncodeHeader(hdrs)
http2Conn.fr.WriteHeaders(hp)
actualCodes := []http2.ErrCode{http2.ErrCodeProtocol}
return TestStreamError(ctx, http2Conn, actualCodes)
},
))
tg.AddTestCase(NewTestCase(
"Sends PRIORITY frame that depend on itself",
"The endpoint MUST treat this as a stream error of type PROTOCOL_ERROR",
func(ctx *Context) (pass bool, expected []Result, actual Result) {
http2Conn := CreateHttp2Conn(ctx, true)
defer http2Conn.conn.Close()
var pp http2.PriorityParam
pp.StreamDep = 2
pp.Exclusive = false
pp.Weight = 255
http2Conn.fr.WritePriority(2, pp)
actualCodes := []http2.ErrCode{http2.ErrCodeProtocol}
return TestStreamError(ctx, http2Conn, actualCodes)
},
))
return tg
}