hugo-micropub/bunnycdn.go

19 lines
403 B
Go
Raw Normal View History

package main
import (
"net/http"
)
func Purge(url string) {
2019-12-06 09:32:30 +00:00
if len(BunnyCdnKey) == 0 {
// BunnyCdn deactivated
return
}
client := &http.Client{}
req, _ := http.NewRequest("POST", "https://bunnycdn.com/api/purge?url="+url, nil)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Accept", "application/json")
2019-12-06 09:32:30 +00:00
req.Header.Add("AccessKey", BunnyCdnKey)
_, _ = client.Do(req)
}