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

在golang fasthttp中获取任意请求标头值

Searched through docs and read source, could not find anyway to access something like

ctx.Request.Header.Get("X-Forwarded-For")

I see in header.go, the type RequestHeader struct is defined something like

h     []argsKV
bufKV argsKV

cookies []argsKV

rawHeaders []byte

Is it possible to access these fields without reflection at all?

Found it.

ctx.Request.Header.Peek("X-Forwarded-For")

近期文章

  • Golang软件包意外删除
  • 非静态物体碰撞解析中的怪异问题
  • 从另一个包扩展结构时非导出字段
  • golang切片分配性能
  • golang-忽略json属性而不被序列化的优雅方法
  • 将密码从[] byte转换为字符串时,请在wincred软件包中添加空格
  • 在Golang中将整数转换为浮点数
  • 无法从Golang运行bash`read`命令[重复]
  • Go中的XML解码
  • 在Golang中设置网络名称空间后运行GRPC时是否存在任何已知限制?
  • Google Speech API:置信度为0.000000
  • 从另一个队列中轮询一个简单队列,并从第二个队列填充第一个队列
  • 将Scala转换成golang是否可能/有用?
  • sql包的“导入错误数据库/ sql”
  • 当通配符参数中出现双斜杠时,为什么大猩猩复用器会重定向?
  • 如何使用Go的openpgp软件包?
  • 在go例程运行时如何为struct赋值?
  • 如果语句总是被跳过
  • 部署Go App
  • 去base64图像解码

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

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

友情链接:代码精华