本文整理匯總了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
}