Skip to content

Commit fcbb51a

Browse files
committed
Fix Some Bugs in the Fetchers
1 parent c7b12b3 commit fcbb51a

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

lib/src/client/github.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ class GitHub {
278278

279279
return request("GET", path, headers: headers, params: params).then((response) {
280280
if (statusCode != null && statusCode != response.statusCode) {
281-
fail(response);
281+
fail != null ? fail(response) : null;
282282
_handleStatusCode(response, response.statusCode);
283283
return new Future.value(null);
284284
}
@@ -315,7 +315,7 @@ class GitHub {
315315

316316
return request("POST", path, headers: headers, params: params, body: body).then((response) {
317317
if (statusCode != null && statusCode != response.statusCode) {
318-
fail(response);
318+
fail != null ? fail(response) : null;
319319
_handleStatusCode(response, response.statusCode);
320320
return new Future.value(null);
321321
}

lib/src/client/repo.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class Repository {
9898

9999
RepositorySlug get slug => new RepositorySlug(owner.login, name);
100100

101-
Future<List<Issue>> issues({int limit: 30}) => github.getJSON("/repos/${fullName}/issues", params: { "per_page": limit }).then((json) {
101+
Future<List<Issue>> issues({int limit: 30}) => github.getJSON("/repos/${fullName}/issues", statusCode: 200, params: { "per_page": limit }).then((json) {
102102
return json.map((it) => Issue.fromJSON(github, it));
103103
});
104104

@@ -111,7 +111,7 @@ class Repository {
111111
handle = (GitHub gh, json) {
112112
if (json is Map) {
113113
new Future.delayed(new Duration(milliseconds: 200), () {
114-
github.getJSON(path, convert: handle, params: { "per_page": limit });
114+
github.getJSON(path, statusCode: 200, convert: handle, params: { "per_page": limit });
115115
});
116116
return null;
117117
} else {
@@ -123,23 +123,23 @@ class Repository {
123123
}
124124

125125
Future<List<Repository>> forks({int limit: 30}) {
126-
return github.getJSON("/repos/${fullName}/forks", params: { "per_page": limit }).then((forks) {
126+
return github.getJSON("/repos/${fullName}/forks", statusCode: 200, params: { "per_page": limit }).then((forks) {
127127
return copyOf(forks.map((it) => Repository.fromJSON(github, it)));
128128
});
129129
}
130130

131131
Future<List<PullRequest>> pullRequests({int limit: 30}) {
132-
return github.getJSON("/repos/${fullName}/pulls", params: { "per_page": limit }).then((List<Map> pulls) {
132+
return github.getJSON("/repos/${fullName}/pulls", statusCode: 200, params: { "per_page": limit }).then((List<Map> pulls) {
133133
return copyOf(pulls.map((it) => PullRequest.fromJSON(github, it)));
134134
});
135135
}
136136

137137
Future<RepositoryPages> pages() {
138-
return github.getJSON("/repos/${fullName}/pages", convert: RepositoryPages.fromJSON);
138+
return github.getJSON("/repos/${fullName}/pages", statusCode: 200, convert: RepositoryPages.fromJSON);
139139
}
140140

141141
Future<List<Hook>> hooks({int limit: 30}) {
142-
return github.getJSON("/repos/${fullName}/hooks", params: { "per_page": limit }).then((hooks) {
142+
return github.getJSON("/repos/${fullName}/hooks", statusCode: 200, params: { "per_page": limit }).then((hooks) {
143143
return copyOf(hooks.map((it) => Hook.fromJSON(github, fullName, it)));
144144
});
145145
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy