Skip to content

Instantly share code, notes, and snippets.

@drtaka
Created January 31, 2020 05:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drtaka/8e0b3b790a0e82329bb4ff1e0b48557e to your computer and use it in GitHub Desktop.
Save drtaka/8e0b3b790a0e82329bb4ff1e0b48557e to your computer and use it in GitHub Desktop.
package main
import (
"net/http"
"os"
"log"
)
/**
http.Request はクライアント、サーバ両方で使える。
*/
func main() {
req, err := http.NewRequest("GET", "http://example.com", nil)
if err != nil {
log.Fatal(err)
}
req.Header.Set("X-TEST", "add custom header")
req.Write(os.Stdout)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment