4

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?

Grokify
  • 15,092
  • 6
  • 60
  • 81
est
  • 11,429
  • 14
  • 70
  • 118

1 Answers1

9

Found it.

ctx.Request.Header.Peek("X-Forwarded-For")
est
  • 11,429
  • 14
  • 70
  • 118