Add a trailing slash to URL when updating or deleting a file (tests fixed) (#931)

* Add a trailing slash to URL when updating or deleting a file.

* Update test files to match new create/update/delete_file Repo methods

* Add trailing slash to get_contents() method

* update tests

* add missing slash in get_dir_contents

* add example usage

* remove dup slashes in tests

* clarify example comments
This commit is contained in:
AetherDeity
2018-10-17 08:21:17 +08:00
committed by Wan Liuyang
parent 9d2129c7b9
commit ee9f098d91
6 changed files with 112 additions and 23 deletions
+5 -5
View File
@@ -1449,7 +1449,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
url_parameters["ref"] = ref
headers, data = self._requester.requestJsonAndCheck(
"GET",
self.url + "/contents" + urllib.quote(path),
self.url + "/contents/" + urllib.quote(path),
parameters=url_parameters
)
if isinstance(data, list):
@@ -1530,7 +1530,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
headers, data = self._requester.requestJsonAndCheck(
"PUT",
self.url + "/contents" + urllib.quote(path),
self.url + "/contents/" + urllib.quote(path),
input=put_parameters
)
@@ -1594,7 +1594,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
headers, data = self._requester.requestJsonAndCheck(
"PUT",
self.url + "/contents" + urllib.quote(path),
self.url + "/contents/" + urllib.quote(path),
input=put_parameters
)
@@ -1644,7 +1644,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
headers, data = self._requester.requestJsonAndCheck(
"DELETE",
self.url + "/contents" + urllib.quote(path),
self.url + "/contents/" + urllib.quote(path),
input=url_parameters
)
@@ -1665,7 +1665,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
url_parameters["ref"] = ref
headers, data = self._requester.requestJsonAndCheck(
"GET",
self.url + "/contents" + urllib.quote(path),
self.url + "/contents/" + urllib.quote(path),
parameters=url_parameters
)