зеркало из https://github.com/Azure/git-rest-api.git
[bugfix] fetch post (#103)
* add fetch request method post * upgrade version * fix lint * update package-lock Co-authored-by: Ray Chen <raychen@microsoft.com>
This commit is contained in:
Родитель
2237feefbc
Коммит
2bbe9fc7f5
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "git-rest-api",
|
||||
"version": "0.3.4",
|
||||
"version": "0.3.5",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "git-rest-api",
|
||||
"version": "0.3.4",
|
||||
"version": "0.3.5",
|
||||
"description": "This project welcomes contributions and suggestions. Most contributions require you to agree to a\r Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us\r the rights to use your contribution. For details, visit https://cla.microsoft.com.",
|
||||
"main": "bin/main.js",
|
||||
"scripts": {
|
||||
|
|
|
@ -51,6 +51,7 @@ describe("PermissionService", () => {
|
|||
headers: {
|
||||
Authorization: auth.toAuthorizationHeader(),
|
||||
},
|
||||
method: "POST",
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -65,12 +66,14 @@ describe("PermissionService", () => {
|
|||
headers: {
|
||||
Authorization: auth.toAuthorizationHeader(),
|
||||
},
|
||||
method: "POST",
|
||||
});
|
||||
|
||||
expect(httpSpy.fetch).toHaveBeenCalledWith("https://github.com/Azure/some-repo.git/git-upload-pack", {
|
||||
headers: {
|
||||
Authorization: auth.toAuthorizationHeader(),
|
||||
},
|
||||
method: "POST",
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -87,6 +90,7 @@ describe("PermissionService", () => {
|
|||
headers: {
|
||||
Authorization: auth.toAuthorizationHeader(),
|
||||
},
|
||||
method: "POST",
|
||||
},
|
||||
);
|
||||
|
||||
|
@ -96,6 +100,7 @@ describe("PermissionService", () => {
|
|||
headers: {
|
||||
Authorization: auth.toAuthorizationHeader(),
|
||||
},
|
||||
method: "POST",
|
||||
},
|
||||
);
|
||||
});
|
||||
|
|
|
@ -39,6 +39,7 @@ export class PermissionService {
|
|||
private async checkWritePermission(auth: RepoAuth, gitUrl: string): Promise<boolean> {
|
||||
const response = await this.http.fetch(`${gitUrl}/${GitServices.Push}`, {
|
||||
headers: this.getHeaders(auth),
|
||||
method: "POST",
|
||||
});
|
||||
return response.status === 200;
|
||||
}
|
||||
|
@ -46,6 +47,7 @@ export class PermissionService {
|
|||
private async checkReadPermission(auth: RepoAuth, gitUrl: string): Promise<boolean> {
|
||||
const response = await this.http.fetch(`${gitUrl}/${GitServices.Pull}`, {
|
||||
headers: this.getHeaders(auth),
|
||||
method: "POST",
|
||||
});
|
||||
return response.status === 200;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче