(t *testing.T)
| 1015 | } |
| 1016 | |
| 1017 | func Test_apiRun_arrayPaginationREST_with_headers(t *testing.T) { |
| 1018 | ios, _, stdout, stderr := iostreams.Test() |
| 1019 | |
| 1020 | requestCount := 0 |
| 1021 | responses := []*http.Response{ |
| 1022 | { |
| 1023 | Proto: "HTTP/1.1", |
| 1024 | Status: "200 OK", |
| 1025 | StatusCode: 200, |
| 1026 | Body: io.NopCloser(bytes.NewBufferString(`[{"page":1}]`)), |
| 1027 | Header: http.Header{ |
| 1028 | "Content-Type": []string{"application/json"}, |
| 1029 | "Link": []string{`<https://api.github.com/repositories/1227/issues?page=2>; rel="next", <https://api.github.com/repositories/1227/issues?page=3>; rel="last"`}, |
| 1030 | "X-Github-Request-Id": []string{"1"}, |
| 1031 | }, |
| 1032 | }, |
| 1033 | { |
| 1034 | Proto: "HTTP/1.1", |
| 1035 | Status: "200 OK", |
| 1036 | StatusCode: 200, |
| 1037 | Body: io.NopCloser(bytes.NewBufferString(`[{"page":2}]`)), |
| 1038 | Header: http.Header{ |
| 1039 | "Content-Type": []string{"application/json"}, |
| 1040 | "Link": []string{`<https://api.github.com/repositories/1227/issues?page=3>; rel="next", <https://api.github.com/repositories/1227/issues?page=3>; rel="last"`}, |
| 1041 | "X-Github-Request-Id": []string{"2"}, |
| 1042 | }, |
| 1043 | }, |
| 1044 | { |
| 1045 | Proto: "HTTP/1.1", |
| 1046 | Status: "200 OK", |
| 1047 | StatusCode: 200, |
| 1048 | Body: io.NopCloser(bytes.NewBufferString(`[{"page":3}]`)), |
| 1049 | Header: http.Header{ |
| 1050 | "Content-Type": []string{"application/json"}, |
| 1051 | "X-Github-Request-Id": []string{"3"}, |
| 1052 | }, |
| 1053 | }, |
| 1054 | } |
| 1055 | |
| 1056 | options := ApiOptions{ |
| 1057 | IO: ios, |
| 1058 | HttpClient: func(rootapi.HTTPClientOptions) (*http.Client, error) { |
| 1059 | var tr roundTripper = func(req *http.Request) (*http.Response, error) { |
| 1060 | resp := responses[requestCount] |
| 1061 | resp.Request = req |
| 1062 | requestCount++ |
| 1063 | return resp, nil |
| 1064 | } |
| 1065 | return &http.Client{Transport: tr}, nil |
| 1066 | }, |
| 1067 | Config: func() (gh.Config, error) { |
| 1068 | return config.NewMockConfig(), nil |
| 1069 | }, |
| 1070 | |
| 1071 | RequestMethod: "GET", |
| 1072 | RequestMethodPassed: true, |
| 1073 | RequestPath: "issues", |
| 1074 | Paginate: true, |
nothing calls this directly
no test coverage detected