Skip to content

Commit 24c5762

Browse files
author
Dylan Reimerink
committed
Fixed coding standards issues
1 parent 060d516 commit 24c5762

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

cacheability.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -296,12 +296,12 @@ func isMethodCacheable(config *CacheConfig, method string) bool {
296296
return false
297297
}
298298

299-
//isResponseCacheableByExtension checks if a response is cacheable based on supported Cache-Control extensions
300-
// https://tools.ietf.org/html/rfc7234#section-5.2.3
301-
func isResponseCacheableByExtension(config *CacheConfig, resp *http.Response) bool {
302-
//TODO find and implement cache extension
303-
return false
304-
}
299+
// //isResponseCacheableByExtension checks if a response is cacheable based on supported Cache-Control extensions
300+
// // https://tools.ietf.org/html/rfc7234#section-5.2.3
301+
// func isResponseCacheableByExtension(config *CacheConfig, resp *http.Response) bool {
302+
// //TODO find and implement cache extension
303+
// return false
304+
// }
305305

306306
//mayServeStaleResponse checks if according to the config and rules specified in RFC7234 the caching server is allowed to serve the response if it is stale
307307
func mayServeStaleResponse(cacheConfig *CacheConfig, response *http.Response) bool {

controller.go

+2-4
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ func (controller *CacheController) ServeHTTP(resp http.ResponseWriter, req *http
115115
// If response has not been set from the cache or by the revalidation process
116116
// Proxy the request to the origin server
117117
if response == nil {
118-
response, stop = controller.proxyRequestToOrigin(cacheConfig, forwardConfig, transport, resp, req, response)
118+
response, stop = controller.proxyRequestToOrigin(cacheConfig, forwardConfig, transport, resp, req)
119119
if stop {
120120
return
121121
}
@@ -144,7 +144,6 @@ func (controller *CacheController) proxyRequestToOrigin(
144144
transport http.RoundTripper,
145145
resp http.ResponseWriter,
146146
req *http.Request,
147-
response *http.Response,
148147
) (
149148
*http.Response,
150149
bool,
@@ -156,8 +155,7 @@ func (controller *CacheController) proxyRequestToOrigin(
156155
defer cancel()
157156
}
158157

159-
var err error
160-
response, err = proxyToOrigin(ctx, transport, forwardConfig, req)
158+
response, err := proxyToOrigin(ctx, transport, forwardConfig, req)
161159
if err != nil {
162160

163161
//Log as a warning since errors here are exprected when a origin server is down

0 commit comments

Comments
 (0)