Skip to content

Commit f0080b2

Browse files
committed
Resolve #251 by correcting response headers
1 parent 1efd5cd commit f0080b2

File tree

12 files changed

+0
-14
lines changed

12 files changed

+0
-14
lines changed

slack_bolt/oauth/async_oauth_flow.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ async def handle_installation(self, request: AsyncBoltRequest) -> BoltResponse:
172172
body=html,
173173
headers={
174174
"Content-Type": "text/html; charset=utf-8",
175-
"Content-Length": len(bytes(html, "utf-8")),
176175
"Set-Cookie": [set_cookie_value],
177176
},
178177
)

slack_bolt/oauth/internals.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ def _build_callback_success_response( # type: ignore
4242
status=200,
4343
headers={
4444
"Content-Type": "text/html; charset=utf-8",
45-
"Content-Length": len(bytes(html, "utf-8")),
4645
"Set-Cookie": self._state_utils.build_set_cookie_for_deletion(),
4746
},
4847
body=html,
@@ -66,7 +65,6 @@ def _build_callback_failure_response( # type: ignore
6665
status=status,
6766
headers={
6867
"Content-Type": "text/html; charset=utf-8",
69-
"Content-Length": len(bytes(html, "utf-8")),
7068
"Set-Cookie": self._state_utils.build_set_cookie_for_deletion(),
7169
},
7270
body=html,

slack_bolt/oauth/oauth_flow.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,6 @@ def handle_installation(self, request: BoltRequest) -> BoltResponse:
167167
body=html,
168168
headers={
169169
"Content-Type": "text/html; charset=utf-8",
170-
"Content-Length": len(bytes(html, "utf-8")),
171170
"Set-Cookie": [set_cookie_value],
172171
},
173172
)

tests/adapter_tests/aws/test_aws_chalice.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,5 +288,4 @@ def install() -> Response:
288288
)
289289
assert response["statusCode"] == 200
290290
assert response["headers"]["content-type"] == "text/html; charset=utf-8"
291-
assert response["headers"]["content-length"] == "565"
292291
assert "https://slack.com/oauth/v2/authorize?state=" in response.get("body")

tests/adapter_tests/aws/test_aws_lambda.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,6 @@ def test_oauth(self):
305305
response = SlackRequestHandler(app).handle(event, self.context)
306306
assert response["statusCode"] == 200
307307
assert response["headers"]["content-type"] == "text/html; charset=utf-8"
308-
assert response["headers"]["content-length"] == "565"
309308
assert response.get("body") is not None
310309

311310
event = {
@@ -318,5 +317,4 @@ def test_oauth(self):
318317
response = SlackRequestHandler(app).handle(event, self.context)
319318
assert response["statusCode"] == 200
320319
assert response["headers"]["content-type"] == "text/html; charset=utf-8"
321-
assert response["headers"]["content-length"] == "565"
322320
assert "https://slack.com/oauth/v2/authorize?state=" in response.get("body")

tests/adapter_tests/django/test_django.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,6 @@ def test_oauth(self):
188188
response = SlackRequestHandler(app).handle(request)
189189
assert response.status_code == 200
190190
assert response.get("content-type") == "text/html; charset=utf-8"
191-
assert response.get("content-length") == "565"
192191
assert "https://slack.com/oauth/v2/authorize?state=" in response.content.decode(
193192
"utf-8"
194193
)

tests/adapter_tests/starlette/test_fastapi.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,5 +213,4 @@ async def endpoint(req: Request):
213213
response = client.get("/slack/install", allow_redirects=False)
214214
assert response.status_code == 200
215215
assert response.headers.get("content-type") == "text/html; charset=utf-8"
216-
assert response.headers.get("content-length") == "565"
217216
assert "https://slack.com/oauth/v2/authorize?state=" in response.text

tests/adapter_tests/starlette/test_starlette.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,5 +222,4 @@ async def endpoint(req: Request):
222222
response = client.get("/slack/install", allow_redirects=False)
223223
assert response.status_code == 200
224224
assert response.headers.get("content-type") == "text/html; charset=utf-8"
225-
assert response.headers.get("content-length") == "565"
226225
assert "https://slack.com/oauth/v2/authorize?state=" in response.text

tests/slack_bolt/oauth/test_oauth_flow.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ def test_handle_installation_default(self):
5656
resp = oauth_flow.handle_installation(req)
5757
assert resp.status == 200
5858
assert resp.headers.get("content-type") == ["text/html; charset=utf-8"]
59-
assert resp.headers.get("content-length") == ["576"]
6059
assert "https://slack.com/oauth/v2/authorize?state=" in resp.body
6160

6261
# https://github.com/slackapi/bolt-python/issues/183

tests/slack_bolt/oauth/test_oauth_flow_sqlite3.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ def test_handle_installation(self):
4141
resp = oauth_flow.handle_installation(req)
4242
assert resp.status == 200
4343
assert resp.headers.get("content-type") == ["text/html; charset=utf-8"]
44-
assert resp.headers.get("content-length") == ["565"]
4544
assert "https://slack.com/oauth/v2/authorize?state=" in resp.body
4645

4746
def test_handle_callback(self):

0 commit comments

Comments
 (0)