"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "pkg/cmd/factory/http_test.go" between
gh-cli-1.12.0.tar.gz and gh-cli-1.12.1.tar.gz

About: GitHub CLI is GitHub’s official command line tool.

http_test.go  (gh-cli-1.12.0):http_test.go  (gh-cli-1.12.1)
skipping to change at line 42 skipping to change at line 42
name: "github.com with Accept header", name: "github.com with Accept header",
args: args{ args: args{
config: tinyConfig{"github.com:oauth_token": "MYTOKEN"}, config: tinyConfig{"github.com:oauth_token": "MYTOKEN"},
appVersion: "v1.2.3", appVersion: "v1.2.3",
setAccept: true, setAccept: true,
}, },
host: "github.com", host: "github.com",
wantHeader: map[string]string{ wantHeader: map[string]string{
"authorization": "token MYTOKEN", "authorization": "token MYTOKEN",
"user-agent": "GitHub CLI v1.2.3", "user-agent": "GitHub CLI v1.2.3",
"accept": "application/vnd.github.merge-in fo-preview+json", "accept": "application/vnd.github.merge-in fo-preview+json, application/vnd.github.nebula-preview",
}, },
wantStderr: "", wantStderr: "",
}, },
{ {
name: "github.com no Accept header", name: "github.com no Accept header",
args: args{ args: args{
config: tinyConfig{"github.com:oauth_token": "MYTOKEN"}, config: tinyConfig{"github.com:oauth_token": "MYTOKEN"},
appVersion: "v1.2.3", appVersion: "v1.2.3",
setAccept: false, setAccept: false,
}, },
skipping to change at line 72 skipping to change at line 72
name: "github.com no authentication token", name: "github.com no authentication token",
args: args{ args: args{
config: tinyConfig{"example.com:oauth_token": "MYTOKEN"}, config: tinyConfig{"example.com:oauth_token": "MYTOKEN"},
appVersion: "v1.2.3", appVersion: "v1.2.3",
setAccept: true, setAccept: true,
}, },
host: "github.com", host: "github.com",
wantHeader: map[string]string{ wantHeader: map[string]string{
"authorization": "", "authorization": "",
"user-agent": "GitHub CLI v1.2.3", "user-agent": "GitHub CLI v1.2.3",
"accept": "application/vnd.github.merge-in fo-preview+json", "accept": "application/vnd.github.merge-in fo-preview+json, application/vnd.github.nebula-preview",
}, },
wantStderr: "", wantStderr: "",
}, },
{ {
name: "github.com in verbose mode", name: "github.com in verbose mode",
args: args{ args: args{
config: tinyConfig{"github.com:oauth_token": "MYTOKEN"}, config: tinyConfig{"github.com:oauth_token": "MYTOKEN"},
appVersion: "v1.2.3", appVersion: "v1.2.3",
setAccept: true, setAccept: true,
}, },
host: "github.com", host: "github.com",
envDebug: "api", envDebug: "api",
wantHeader: map[string]string{ wantHeader: map[string]string{
"authorization": "token MYTOKEN", "authorization": "token MYTOKEN",
"user-agent": "GitHub CLI v1.2.3", "user-agent": "GitHub CLI v1.2.3",
"accept": "application/vnd.github.merge-in fo-preview+json", "accept": "application/vnd.github.merge-in fo-preview+json, application/vnd.github.nebula-preview",
}, },
wantStderr: heredoc.Doc(` wantStderr: heredoc.Doc(`
* Request at <time> * Request at <time>
* Request to http://<host>:<port> * Request to http://<host>:<port>
> GET / HTTP/1.1 > GET / HTTP/1.1
> Host: github.com > Host: github.com
> Accept: application/vnd.github.merge-info-previ ew+json > Accept: application/vnd.github.merge-info-previ ew+json, application/vnd.github.nebula-preview
> Authorization: token ████████████████████ > Authorization: token ████████████████████
> User-Agent: GitHub CLI v1.2.3 > User-Agent: GitHub CLI v1.2.3
< HTTP/1.1 204 No Content < HTTP/1.1 204 No Content
< Date: <time> < Date: <time>
* Request took <duration> * Request took <duration>
`), `),
}, },
{ {
name: "GHES Accept header", name: "GHES Accept header",
args: args{ args: args{
config: tinyConfig{"example.com:oauth_token": "GHETOKEN"}, config: tinyConfig{"example.com:oauth_token": "GHETOKEN"},
appVersion: "v1.2.3", appVersion: "v1.2.3",
setAccept: true, setAccept: true,
}, },
host: "example.com", host: "example.com",
wantHeader: map[string]string{ wantHeader: map[string]string{
"authorization": "token GHETOKEN", "authorization": "token GHETOKEN",
"user-agent": "GitHub CLI v1.2.3", "user-agent": "GitHub CLI v1.2.3",
"accept": "application/vnd.github.merge-in fo-preview+json, application/vnd.github.antiope-preview, application/vnd.github. shadow-cat-preview", "accept": "application/vnd.github.merge-in fo-preview+json, application/vnd.github.nebula-preview, application/vnd.github.a ntiope-preview, application/vnd.github.shadow-cat-preview",
}, },
wantStderr: "", wantStderr: "",
}, },
} }
var gotReq *http.Request var gotReq *http.Request
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r * http.Request) { ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r * http.Request) {
gotReq = r gotReq = r
w.WriteHeader(http.StatusNoContent) w.WriteHeader(http.StatusNoContent)
})) }))
 End of changes. 5 change blocks. 
5 lines changed or deleted 5 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)