Merge pull request #232 from marzeelabs/feature/#222_encodeuri_branch_name

#222 - Encode branch name on requests to avoid errors with special chars
This commit is contained in:
Cássio Souza 2017-02-07 17:38:00 -02:00 committed by GitHub
commit 27275ed677

View File

@ -331,20 +331,20 @@ export default class API {
}
patchRef(type, name, sha) {
return this.request(`${ this.repoURL }/git/refs/${ type }/${ name }`, {
return this.request(`${ this.repoURL }/git/refs/${ type }/${ encodeURIComponent(name) }`, {
method: "PATCH",
body: JSON.stringify({ sha }),
});
}
deleteRef(type, name, sha) {
return this.request(`${ this.repoURL }/git/refs/${ type }/${ name }`, {
return this.request(`${ this.repoURL }/git/refs/${ type }/${ encodeURIComponent(name) }`, {
method: "DELETE",
});
}
getBranch(branch = this.branch) {
return this.request(`${ this.repoURL }/branches/${ branch }`);
return this.request(`${ this.repoURL }/branches/${ encodeURIComponent(branch) }`);
}
createBranch(branchName, sha) {