mirror of
https://git.vectorsigma.ru/public/atlantis.git
synced 2026-08-02 13:28:52 +00:00
Use int instead of string for bitbucket response.
This commit is contained in:
@@ -63,13 +63,13 @@ func (b *Client) GetModifiedFiles(repo models.Repo, pull models.PullRequest) ([]
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
nextPageStart := "0"
|
||||
nextPageStart := 0
|
||||
baseURL := fmt.Sprintf("%s/rest/api/1.0/projects/%s/repos/%s/pull-requests/%d/changes",
|
||||
b.BaseURL, projectKey, repo.Name, pull.Num)
|
||||
// We'll only loop 1000 times as a safety measure.
|
||||
maxLoops := 1000
|
||||
for i := 0; i < maxLoops; i++ {
|
||||
resp, err := b.makeRequest("GET", fmt.Sprintf("%s?start=%s", baseURL, nextPageStart), nil)
|
||||
resp, err := b.makeRequest("GET", fmt.Sprintf("%s?start=%d", baseURL, nextPageStart), nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ func TestClient_GetModifiedFilesPagination(t *testing.T) {
|
||||
// The first request should hit this URL.
|
||||
case "/rest/api/1.0/projects/ow/repos/repo/pull-requests/1/changes?start=0":
|
||||
resp := strings.Replace(firstResp, `"isLastPage": true`, `"isLastPage": false`, -1)
|
||||
resp = strings.Replace(resp, `"nextPageStart": null`, `"nextPageStart": "3"`, -1)
|
||||
resp = strings.Replace(resp, `"nextPageStart": null`, `"nextPageStart": 3`, -1)
|
||||
w.Write([]byte(resp)) // nolint: errcheck
|
||||
return
|
||||
// The second should hit this URL.
|
||||
|
||||
@@ -61,6 +61,6 @@ type Changes struct {
|
||||
ToString *string `json:"toString,omitempty" validate:"required"`
|
||||
} `json:"path,omitempty" validate:"required"`
|
||||
} `json:"values,omitempty" validate:"required"`
|
||||
NextPageStart *string `json:"nextPageStart,omitempty"`
|
||||
IsLastPage *bool `json:"isLastPage,omitempty" validate:"required"`
|
||||
NextPageStart *int `json:"nextPageStart,omitempty"`
|
||||
IsLastPage *bool `json:"isLastPage,omitempty" validate:"required"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user