2019-11-09 16:35:54 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
)
|
|
|
|
|
|
|
|
func Purge(url string) {
|
2019-12-06 09:32:30 +00:00
|
|
|
if len(BunnyCdnKey) == 0 {
|
|
|
|
// BunnyCdn deactivated
|
2019-11-09 16:35:54 +00:00
|
|
|
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)
|
2019-11-09 16:35:54 +00:00
|
|
|
_, _ = client.Do(req)
|
|
|
|
}
|