MCPcopy Create free account
hub / github.com/Flagsmith/flagsmith / _get_headers

Function _get_headers

api/edge_api/identities/edge_request_forwarder.py:66–76  ·  view source on GitHub ↗
(request_method: str, headers: dict, payload: str = "")

Source from the content-addressed store, hash-verified

64
65
66def _get_headers(request_method: str, headers: dict, payload: str = "") -> dict: # type: ignore[type-arg]
67 headers = {k: v for k, v in headers.items()}
68 # Django by default sets the content-length to "", which in the case of get request(lack of content body)
69 # Remains an empty string - an invalid value(according to edge alb and HTTP spec).
70 # Hence, we need to remove this header to turn this into a valid request
71 # ref: https://groups.google.com/g/django-developers/c/xjYVJN-RguA/m/G9krDqawchQJ
72 if request_method == "GET":
73 headers.pop("Content-Length", None)
74 signature = sign_payload(payload, settings.EDGE_REQUEST_SIGNING_KEY) # type: ignore[arg-type]
75 headers[FLAGSMITH_SIGNATURE_HEADER] = signature
76 return headers

Callers 2

forward_identity_requestFunction · 0.85
forward_trait_requestFunction · 0.85

Calls 1

sign_payloadFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…