FAQ
This is a old thread, but I needed this today, to see all headers I used:

for k, v := range resp.Header {
fmt.Println(k, ": ", v)
}

[]s
Em domingo, 19 de fevereiro de 2012 15h29min03s UTC-2, Xan escreveu:

And how to get __all__ the headers?
It seems we could print with fmt resposta.Header, isn't?

Regards,
Xan.
On Feb 12, 8:44 pm, Rodrigo Moraes wrote:
Response.Header is a map with the headers. Simply access it without
reading it.

resposta, error := http.Get(url)
if error == nil {
contentType := resposta.Header.Get("Content-Type")
// ...
}

See:

http://golang.org/pkg/http/#Response
http://golang.org/pkg/http/#Header

-- rodrigo
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedDec 16, '14 at 7:29p
activeDec 16, '14 at 7:29p
posts1
users1
websitegolang.org

1 user in discussion

Guilherme Rezende: 1 post

People

Translate

site design / logo © 2021 Grokbase