我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

我可以发出仅使用HTTP / 2的HTTP请求吗

I am working on some scripts to test our infrastructure at various levels. I am trying to make tests to verify functionality for clients both with and without http2. The docs specify how to disable http2 by overriding Transport.TLSNextProto, but I can't find any way to require http2.

Is there a way to require an http request uses http/2 only? Or if not is there any kind of field or hook to see if it used http2 or not?

You can use Response.ProtoAtLeast(2, 0) to check if it came in over version 2. See: https://golang.org/pkg/net/http/#Response.ProtoAtLeast

近期文章

  • 如何在不使用Next()的情况下获取sql.Rows的计数?
  • 为什么通道的方向变化不兼容?
  • 向结构添加“静态”功能
  • 关于Goroutine的Golang内存泄漏
  • 如何在Golang中的包下获取所有结构?
  • 如何获取http.ListenAndServe的地址
  • 转到客户端以访问GAE登录所需的应用
  • 正则表达式与golang中嵌套组的问题
  • Golang微服务无法使用Docker for Mac进行通信
  • 如何在Golang中使用Jar文件?
  • 转到:将var转换为匿名函数
  • Golang储存库模式
  • 倾销Avahi和Bonjour,DNS-SD区域文件
  • Dockerhub具有多个私有存储库的自动化构建
  • 学习Go或提高我的Python / Ruby知识[关闭]
  • golang解析POST请求
  • 使用nodejs客户端访问golang websocket服务器
  • 等价于Go中的sizeof(aType)
  • 在REST API上执行错误处理
  • 如何使用GORM创建Postgres数据库

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华