From ddecc72b3f9541281e9bc04642c52a0fb781fe96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Sun, 19 Jan 2020 15:47:17 +0100 Subject: [PATCH] Ensure `response.Request` is populated for responses from cache https://github.com/github/hub/runs/397657829 --- features/api.feature | 2 +- github/http.go | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/features/api.feature b/features/api.feature index d3cd4dc3..362d2f9d 100644 --- a/features/api.feature +++ b/features/api.feature @@ -524,7 +524,7 @@ Feature: hub api Then the exit status should be 22 And the stderr should contain exactly: """ - + You must authorize your token to access this organization: http://example.com?auth=HASH """ diff --git a/github/http.go b/github/http.go index ecf77bb4..eb7b9f04 100644 --- a/github/http.go +++ b/github/http.go @@ -341,8 +341,9 @@ func (c *simpleClient) cacheRead(key string, req *http.Request) (res *http.Respo } res = &http.Response{ - Body: ioutil.NopCloser(bytes.NewBufferString(parts[1])), - Header: http.Header{}, + Body: ioutil.NopCloser(bytes.NewBufferString(parts[1])), + Header: http.Header{}, + Request: req, } headerLines := strings.Split(parts[0], "\r\n") if len(headerLines) < 1 {