package main
import (
"log"
"net/http"
"github.com/saihon/referrer"
)
func main() {
r := referrer.New()
r.SetPolicy(referrer.POLICY_ORIGIN_WHEN_CROSS_ORIGIN)
fromURL := "http://example.com/from"
toURL := "http://example.com/to"
req, err := http.NewRequest(`GET`, toURL, nil)
if err != nil {
log.Fatal(err)
}
referer, ok := r.Make(fromURL, toURL)
// set referer
if ok {
req.Header.Set("Referer", referer)
}
http.DefaultClient.Do(req)
}
-
Notifications
You must be signed in to change notification settings - Fork 0
Referrer policy for Go language
License
saihon/referrer
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Referrer policy for Go language
Topics
Resources
License
Stars
Watchers
Forks
Packages 0
No packages published