Skip to content

Commit 3beb0bd

Browse files
authored
Merge pull request #421 from Vault108/main
fixed git.io shorting issue
2 parents d9ee9f1 + 8b348e4 commit 3beb0bd

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

cloudbot/util/web.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ class Gitio(Shortener):
309309
def shorten(self, url, custom=None, key=None):
310310
p = {"url": url, "code": custom}
311311
try:
312-
r = requests.post("http://git.io", data=p)
312+
r = requests.post("https://git.io", data=p)
313313
r.raise_for_status()
314314
except HTTPError as e:
315315
r = e.response

tests/core_tests/util_tests/test_web.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,29 +121,29 @@ def test_shorten(mock_requests):
121121

122122
mock_requests.add(
123123
"POST",
124-
"http://git.io",
124+
"https://git.io",
125125
status=400,
126126
)
127127
with pytest.raises(web.ServiceHTTPError):
128128
web.shorten("https://example.com", service="git.io")
129129

130-
mock_requests.replace("POST", "http://git.io", body="error")
130+
mock_requests.replace("POST", "https://git.io", body="error")
131131
with pytest.raises(web.ServiceHTTPError):
132132
web.shorten("https://example.com", service="git.io")
133133

134-
mock_requests.replace("POST", "http://git.io", body="error")
134+
mock_requests.replace("POST", "https://git.io", body="error")
135135
with pytest.raises(web.ServiceHTTPError):
136136
web.shorten("https://example.com", service="git.io")
137137

138138
mock_requests.replace(
139139
"POST",
140-
"http://git.io",
141-
headers={"Location": "http://git.io/foobar123"},
140+
"https://git.io",
141+
headers={"Location": "https://git.io/foobar123"},
142142
status=requests.codes.created,
143143
)
144144
assert (
145145
web.shorten("https://example.com", service="git.io")
146-
== "http://git.io/foobar123"
146+
== "https://git.io/foobar123"
147147
)
148148

149149
with pytest.raises(web.ServiceHTTPError):

tests/plugin_tests/test_shorten.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def test_gitio(mock_requests):
113113

114114
mock_requests.add(
115115
"POST",
116-
"http://git.io",
116+
"https://git.io",
117117
headers={"Location": "https://git.io/foobar"},
118118
status=requests.codes.created,
119119
)

0 commit comments

Comments
 (0)