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

Function send_test_request_to_webhook

api/webhooks/webhooks.py:315–336  ·  view source on GitHub ↗
(
    url: str, secret: str | None, webhook_type: WebhookType
)

Source from the content-addressed store, hash-verified

313
314
315def send_test_request_to_webhook(
316 url: str, secret: str | None, webhook_type: WebhookType
317) -> requests.models.Response:
318 test_data = (
319 generate_environment_sample_webhook_data()
320 if webhook_type == WebhookType.ENVIRONMENT
321 else generate_organisation_sample_webhook_data()
322 )
323
324 json_data = json.dumps(
325 test_data,
326 sort_keys=True,
327 cls=DjangoJSONEncoder,
328 )
329 headers = {"content-type": "application/json"}
330 if secret:
331 signed_payload = sign_payload(json_data, secret)
332 headers.update({FLAGSMITH_SIGNATURE_HEADER: signed_payload})
333 res = requests.post(
334 url, data=json_data, headers=headers, timeout=10, allow_redirects=False
335 )
336 return res
337
338
339def generate_environment_sample_webhook_data() -> dict[str, Any]:

Callers 1

testMethod · 0.85

Calls 5

sign_payloadFunction · 0.90
updateMethod · 0.45
postMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…