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

Commit

Permalink
Add Status and StatusCode to mock responses
Browse files Browse the repository at this point in the history
Go 1.6 errors if Responses don't have a valid status code, which meant
these tests were failing.

Fixes #38
  • Loading branch information
gregjones committed Mar 13, 2016
1 parent 6f21ebc commit 702602a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions httpcache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,8 @@ func (s *S) TestStaleIfErrorRequest(c *C) {
now := time.Now()
tmock := transportMock{
response: &http.Response{
Status: http.StatusText(http.StatusOK),
StatusCode: http.StatusOK,
Header: http.Header{
"Date": []string{now.Format(time.RFC1123)},
"Cache-Control": []string{"no-cache"},
Expand Down Expand Up @@ -595,6 +597,8 @@ func (s *S) TestStaleIfErrorRequestLifetime(c *C) {
now := time.Now()
tmock := transportMock{
response: &http.Response{
Status: http.StatusText(http.StatusOK),
StatusCode: http.StatusOK,
Header: http.Header{
"Date": []string{now.Format(time.RFC1123)},
"Cache-Control": []string{"no-cache"},
Expand Down Expand Up @@ -637,6 +641,8 @@ func (s *S) TestStaleIfErrorResponse(c *C) {
now := time.Now()
tmock := transportMock{
response: &http.Response{
Status: http.StatusText(http.StatusOK),
StatusCode: http.StatusOK,
Header: http.Header{
"Date": []string{now.Format(time.RFC1123)},
"Cache-Control": []string{"no-cache, stale-if-error"},
Expand Down Expand Up @@ -666,6 +672,8 @@ func (s *S) TestStaleIfErrorResponseLifetime(c *C) {
now := time.Now()
tmock := transportMock{
response: &http.Response{
Status: http.StatusText(http.StatusOK),
StatusCode: http.StatusOK,
Header: http.Header{
"Date": []string{now.Format(time.RFC1123)},
"Cache-Control": []string{"no-cache, stale-if-error=100"},
Expand Down

0 comments on commit 702602a

Please sign in to comment.