Skip to content

Capitalized Retry-After header missing since 3.12.0 #1143

@joekohlsdorf

Description

@joekohlsdorf

Since release 3.12.0 only the lowercase retry-after header is present. The SDK has some compatibility code to add a capitalized Retry-After header which stopped working properly.
If this change was intentional, examples for handling rate-limiting are now wrong: https://github.com/slackapi/python-slack-sdk/blob/v3.12.0/integration_tests/samples/basic_usage/rate_limits.py#L32

The Slack SDK version

3.12.0

Python runtime version

3.9.8

OS info

Ubuntu 20.04

Steps to reproduce:

Hit any API enough times to hit rate limiting. Then inspect the e.response.headers dictionary.

Expected result:

e.response.headers dictionary with 3.11.2 - both lowercase and capitalized Retry-After are present:

{'date': 'Mon, 06 Dec 2021 14:26:31 GMT', 'server': 'Apache', 'access-control-allow-origin': '*', 'referrer-policy': 'no-referrer', 'x-slack-backend': 'r', 'strict-transport-security': 'max-age=31536000; includeSubDomains; preload', 'access-control-allow-headers': 'slack-route, x-slack-version-ts, x-b3-traceid, x-b3-spanid, x-b3-parentspanid, x-b3-sampled, x-b3-flags', 'access-control-expose-headers': 'x-slack-req-id, retry-after', 'x-oauth-scopes': 'users:read,users.profile:read,users:read.email', 'retry-after': '1', 'expires': 'Mon, 26 Jul 1997 05:00:00 GMT', 'cache-control': 'private, no-cache, no-store, must-revalidate', 'pragma': 'no-cache', 'x-xss-protection': '0', 'x-content-type-options': 'nosniff', 'x-slack-req-id': 'c7890817f15fe834072a18116911c0e9', 'vary': 'Accept-Encoding', 'content-type': 'application/json; charset=utf-8', 'x-envoy-upstream-service-time': '131', 'x-backend': 'main_normal main_bedrock_normal_with_overflow main_canary_with_overflow main_bedrock_canary_with_overflow main_control_with_overflow main_bedrock_control_with_overflow', 'x-server': 'slack-www-hhvm-main-iad-a3us', 'x-slack-shared-secret-outcome': 'no-match', 'via': 'envoy-www-iad-59gt, envoy-edge-gru-dirj', 'x-edge-backend': 'envoy-www', 'x-slack-edge-shared-secret-outcome': 'no-match', 'connection': 'close', 'transfer-encoding': 'chunked', 'Retry-After': '1'}

Actual result:

e.response.headers dictionary with 3.12.0 - only lowercase retry-after is present:

{'date': 'Mon, 06 Dec 2021 14:27:32 GMT', 'server': 'Apache', 'access-control-allow-origin': '*', 'referrer-policy': 'no-referrer', 'x-slack-backend': 'r', 'strict-transport-security': 'max-age=31536000; includeSubDomains; preload', 'access-control-allow-headers': 'slack-route, x-slack-version-ts, x-b3-traceid, x-b3-spanid, x-b3-parentspanid, x-b3-sampled, x-b3-flags', 'access-control-expose-headers': 'x-slack-req-id, retry-after', 'x-oauth-scopes': 'users:read,users.profile:read,users:read.email', 'retry-after': '1', 'expires': 'Mon, 26 Jul 1997 05:00:00 GMT', 'cache-control': 'private, no-cache, no-store, must-revalidate', 'pragma': 'no-cache', 'x-xss-protection': '0', 'x-content-type-options': 'nosniff', 'x-slack-req-id': '276e48bf2f6726d20e67665e38560ea3', 'vary': 'Accept-Encoding', 'content-type': 'application/json; charset=utf-8', 'x-envoy-upstream-service-time': '126', 'x-backend': 'main_normal main_bedrock_normal_with_overflow main_canary_with_overflow main_bedrock_canary_with_overflow main_control_with_overflow main_bedrock_control_with_overflow', 'x-server': 'slack-www-hhvm-main-iad-iuhx', 'x-slack-shared-secret-outcome': 'no-match', 'via': 'envoy-www-iad-a4sn, envoy-edge-gru-dhvi', 'x-edge-backend': 'envoy-www', 'x-slack-edge-shared-secret-outcome': 'no-match', 'connection': 'close', 'transfer-encoding': 'chunked'}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions