3

I tried to get all headers in handler and faced some difficulties.

valyala/fasthttp has the needed methods and I can get headlines one by one, but I don`t see the obvious way to get all of the headers.

So, How can I get all of the headers into an array?

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
BlackFox
  • 33
  • 5

1 Answers1

9

Use request.Header.VisitAll. See related doc.

r.Header.VisitAll(func (key, value []byte) {
    log.Printf("%v: %v", key, value)
})
Arman Ordookhani
  • 6,031
  • 28
  • 41
  • 1
    If you are going to answer a question, it would be great if you took a moment to edit it. Also, if the question was worth answering, isn't it likely worth an upvote? Thanks and Cheers! – Stephen Rauch Dec 06 '17 at 02:38