Skip to content

Commit

Permalink
Fix typo in collapsed forwarding header (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevburnsjr authored Oct 2, 2019
1 parent 8d95ad4 commit dafbc3c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions request.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,13 @@ func buildRequestOpts(m *microcache, res Response, r *http.Request) RequestOpts
req.staleWhileRevalidate = time.Duration(staleWhileRevalidateHdr) * time.Second
}

// w.Header().Set("microcache-collapsed-fowarding", "1")
if headers.Get("microcache-collapsed-fowarding") != "" {
// w.Header().Set("microcache-collapsed-forwarding", "1")
if headers.Get("microcache-collapsed-forwarding") != "" {
req.collapsedForwarding = true
}

// w.Header().Set("microcache-no-collapsed-fowarding", "1")
if headers.Get("microcache-no-collapsed-fowarding") != "" {
// w.Header().Set("microcache-no-collapsed-forwarding", "1")
if headers.Get("microcache-no-collapsed-forwarding") != "" {
req.collapsedForwarding = false
}

Expand Down
4 changes: 2 additions & 2 deletions request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ func TestBuildRequestOpts(t *testing.T) {
{"microcache-ttl", "10", RequestOpts{ttl: time.Duration(10 * time.Second)}},
{"microcache-stale-if-error", "10", RequestOpts{staleIfError: time.Duration(10 * time.Second)}},
{"microcache-stale-while-revalidate", "10", RequestOpts{staleWhileRevalidate: time.Duration(10 * time.Second)}},
{"microcache-collapsed-fowarding", "1", RequestOpts{collapsedForwarding: true}},
{"microcache-collapsed-forwarding", "1", RequestOpts{collapsedForwarding: true}},
{"microcache-stale-recache", "1", RequestOpts{staleRecache: true}},
{"Microcache-Vary-Query", "a", RequestOpts{varyQuery: []string{"a"}}},
})
runCases(New(Config{Nocache: true}), []tc{
{"microcache-cache", "1", RequestOpts{nocache: false}},
})
runCases(New(Config{CollapsedForwarding: true}), []tc{
{"microcache-no-collapsed-fowarding", "1", RequestOpts{collapsedForwarding: false}},
{"microcache-no-collapsed-forwarding", "1", RequestOpts{collapsedForwarding: false}},
})
runCases(New(Config{StaleRecache: true}), []tc{
{"microcache-no-stale-recache", "1", RequestOpts{staleRecache: false}},
Expand Down

0 comments on commit dafbc3c

Please sign in to comment.