Skip to content

Commit

Permalink
Fix all_headers provisioning API
Browse files Browse the repository at this point in the history
  • Loading branch information
bradtgmurray committed Feb 1, 2024
1 parent bf6d688 commit 266aa5e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
11 changes: 9 additions & 2 deletions linkedin_matrix/web/provisioning_api.py
Expand Up @@ -106,8 +106,15 @@ def parse_cookies(c):
cookie_dict[key] = val

if "all_headers" in req_data:
parse_cookies(req_data.pop("Cookie", req_data.pop("cookie", "")))
headers = req_data
all_headers = req_data["all_headers"]
parse_cookies(all_headers.pop("Cookie", all_headers.pop("cookie", "")))

# We never want the accept header, skip it
all_headers.pop("Accept")
all_headers.pop("accept")

# Save the rest of the headers
headers = all_headers
elif "cookie_header" in req_data:
parse_cookies(req_data["cookie_header"])
elif "li_at" in req_data and "JSESSIONID" in req_data:
Expand Down
6 changes: 3 additions & 3 deletions linkedin_messaging/linkedin.py
Expand Up @@ -158,9 +158,9 @@ def from_cookies_and_headers(cookies: dict[str, str],

# Skip these headers, including them will result in events being received in a newer
# format that we don't support
linkedin.headers.pop("x-li-query-map", None)
linkedin.headers.pop("x-li-query-accept", None)
linkedin.headers.pop("x-li-accept", None)
linkedin.headers.pop("x-li-query-map")
linkedin.headers.pop("x-li-query-accept")
linkedin.headers.pop("x-li-accept")

return linkedin

Expand Down

0 comments on commit 266aa5e

Please sign in to comment.