Skip to content
This repository was archived by the owner on Apr 20, 2023. It is now read-only.

Commit 4b02602

Browse files
committed
Merge pull request #40 from gregjones/fix-test-responses-missing-status-codes
Add Status and StatusCode to mock responses
2 parents 6f21ebc + be6978e commit 4b02602

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

‎.travis.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ install:
1111
- # Do nothing. This is needed to prevent default install action "go get -t -v ./..." from happening here (we want it to happen inside script step).
1212
script:
1313
- go get -t -v ./...
14-
- diff -u <(echo -n) <(gofmt -d -s .)
14+
- diff -u <(echo -n) <(gofmt -d .)
1515
- go tool vet .
1616
- go test -v -race ./...

‎httpcache_test.go‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,8 @@ func (s *S) TestStaleIfErrorRequest(c *C) {
565565
now := time.Now()
566566
tmock := transportMock{
567567
response: &http.Response{
568+
Status: http.StatusText(http.StatusOK),
569+
StatusCode: http.StatusOK,
568570
Header: http.Header{
569571
"Date": []string{now.Format(time.RFC1123)},
570572
"Cache-Control": []string{"no-cache"},
@@ -595,6 +597,8 @@ func (s *S) TestStaleIfErrorRequestLifetime(c *C) {
595597
now := time.Now()
596598
tmock := transportMock{
597599
response: &http.Response{
600+
Status: http.StatusText(http.StatusOK),
601+
StatusCode: http.StatusOK,
598602
Header: http.Header{
599603
"Date": []string{now.Format(time.RFC1123)},
600604
"Cache-Control": []string{"no-cache"},
@@ -637,6 +641,8 @@ func (s *S) TestStaleIfErrorResponse(c *C) {
637641
now := time.Now()
638642
tmock := transportMock{
639643
response: &http.Response{
644+
Status: http.StatusText(http.StatusOK),
645+
StatusCode: http.StatusOK,
640646
Header: http.Header{
641647
"Date": []string{now.Format(time.RFC1123)},
642648
"Cache-Control": []string{"no-cache, stale-if-error"},
@@ -666,6 +672,8 @@ func (s *S) TestStaleIfErrorResponseLifetime(c *C) {
666672
now := time.Now()
667673
tmock := transportMock{
668674
response: &http.Response{
675+
Status: http.StatusText(http.StatusOK),
676+
StatusCode: http.StatusOK,
669677
Header: http.Header{
670678
"Date": []string{now.Format(time.RFC1123)},
671679
"Cache-Control": []string{"no-cache, stale-if-error=100"},

0 commit comments

Comments
 (0)