mirror of
https://github.com/foomo/contentfulproxy.git
synced 2025-10-16 12:25:37 +00:00
* fix linting issues
This commit is contained in:
parent
4dc8b8fcd5
commit
5a5a170f2e
@ -86,7 +86,7 @@ func NewCache(l *zap.Logger, webHooks func() []string) *Cache {
|
||||
}
|
||||
|
||||
func getCacheIDForRequest(r *http.Request, pathPrefix func() string) cacheID {
|
||||
id := stripPrefixFromUrl(r.URL.RequestURI(), pathPrefix)
|
||||
id := stripPrefixFromURL(r.URL.RequestURI(), pathPrefix)
|
||||
keys := make([]string, len(r.Header))
|
||||
i := 0
|
||||
for k := range r.Header {
|
||||
@ -108,6 +108,6 @@ func getCacheIDForRequest(r *http.Request, pathPrefix func() string) cacheID {
|
||||
return cacheID(id)
|
||||
}
|
||||
|
||||
func stripPrefixFromUrl(url string, pathPrefix func() string) string {
|
||||
func stripPrefixFromURL(url string, pathPrefix func() string) string {
|
||||
return strings.Replace(url, pathPrefix(), "", 1)
|
||||
}
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
package proxy
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/foomo/contentfulproxy/packages/go/log"
|
||||
"go.uber.org/zap"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type requestJobDone struct {
|
||||
@ -22,7 +23,7 @@ type jobRunner func(job requestJob, id cacheID)
|
||||
func getJobRunner(l *zap.Logger, c *Cache, backendURL func() string, pathPrefix func() string, chanJobDone chan requestJobDone) jobRunner {
|
||||
return func(job requestJob, id cacheID) {
|
||||
// backend url is the contentful api domain like https://cdn.contenful.com
|
||||
calledURL := backendURL() + stripPrefixFromUrl(job.request.URL.RequestURI(), pathPrefix)
|
||||
calledURL := backendURL() + stripPrefixFromURL(job.request.URL.RequestURI(), pathPrefix)
|
||||
l.Info("URL called by job-runner", log.FURL(calledURL))
|
||||
req, err := http.NewRequest("GET", calledURL, nil)
|
||||
if err != nil {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user