package main import ( "fmt" "net/http" ) func main() { resp, err := http.Get("https://example.com") if err != nil { // handle error } contentType := resp.Header.Get("Content-Type") fmt.Println("Content-Type:", contentType) }
package main import ( "fmt" "net/http" ) func main() { req, err := http.NewRequest("POST", "https://example.com", nil) if err != nil { // handle error } req.Header.Set("Authorization", "Bearer abc123") client := &http.Client{} resp, err := client.Do(req) if err != nil { // handle error } authHeader := resp.Header.Get("Authorization") fmt.Println("Authorization header:", authHeader) }In this example, we create an HTTP POST request and set the Authorization header to "Bearer abc123". We then make the request and retrieve the value of the Authorization header from the response. The package library used in these examples is net/http.