github.com/drone/runner-go@v1.12.0/handler/nocache.go (about) 1 // Copyright 2019 Drone.IO Inc. All rights reserved. 2 // Use of this source code is governed by the Polyform License 3 // that can be found in the LICENSE file. 4 5 package handler 6 7 import ( 8 "net/http" 9 "time" 10 ) 11 12 // unix epoch time 13 var epoch = time.Unix(0, 0).Format(time.RFC1123) 14 15 // http headers to disable caching. 16 var noCacheHeaders = map[string]string{ 17 "Expires": epoch, 18 "Cache-Control": "no-cache, private, max-age=0", 19 "Pragma": "no-cache", 20 "X-Accel-Expires": "0", 21 } 22 23 // helper function to prevent http response caching. 24 func nocache(w http.ResponseWriter) { 25 for k, v := range noCacheHeaders { 26 w.Header().Set(k, v) 27 } 28 }