Skip to content

Commit 50e44fb

Browse files
committed
Update existing addColaborator to meet Github specs
Update the existing method addCollaborator to meet the current docs. https://docs.github.com/en/rest/collaborators/collaborators#add-a-repository-collaborator Instead of NO_CONTENT, the expected status code is CREATED.
1 parent 7e93cc9 commit 50e44fb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/src/common/repos_service.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,16 +329,17 @@ class RepositoriesService extends Service {
329329
return false;
330330
}
331331

332+
/// https://docs.github.com/en/rest/collaborators/collaborators#add-a-repository-collaborator
332333
Future<bool> addCollaborator(RepositorySlug slug, String user) async {
333334
ArgumentError.checkNotNull(slug);
334335
ArgumentError.checkNotNull(user);
335336
return github
336337
.request(
337338
'PUT',
338339
'/repos/${slug.fullName}/collaborators/$user',
339-
statusCode: StatusCodes.NO_CONTENT,
340+
statusCode: StatusCodes.CREATED,
340341
)
341-
.then((response) => response.statusCode == StatusCodes.NO_CONTENT);
342+
.then((response) => response.statusCode == StatusCodes.CREATED);
342343
}
343344

344345
Future<bool> removeCollaborator(RepositorySlug slug, String user) async {

0 commit comments

Comments
 (0)