How to get all headers in array

2k Views Asked by At

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?

1

There are 1 best solutions below

1
On BEST ANSWER

Use request.Header.VisitAll. See related doc.

r.Header.VisitAll(func (key, value []byte) {
    log.Printf("%v: %v", key, value)
})