mirror of https://github.com/zulip/zulip.git
outgoing_webhook: Set an X-Smokescreen-Role on requests.
This header is used by the Smokescreen outgoing proxy to provide identification.
This commit is contained in:
parent
bd37dc0b83
commit
134db206a9
|
@ -31,7 +31,12 @@ class OutgoingWebhookServiceInterface(metaclass=abc.ABCMeta):
|
||||||
self.user_profile: UserProfile = user_profile
|
self.user_profile: UserProfile = user_profile
|
||||||
self.service_name: str = service_name
|
self.service_name: str = service_name
|
||||||
self.session: Session = Session()
|
self.session: Session = Session()
|
||||||
self.session.headers.update({"User-Agent": "ZulipOutgoingWebhook/" + ZULIP_VERSION})
|
self.session.headers.update(
|
||||||
|
{
|
||||||
|
"X-Smokescreen-Role": "webhook",
|
||||||
|
"User-Agent": "ZulipOutgoingWebhook/" + ZULIP_VERSION,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def make_request(self, base_url: str, event: Dict[str, Any]) -> Optional[Response]:
|
def make_request(self, base_url: str, event: Dict[str, Any]) -> Optional[Response]:
|
||||||
|
|
|
@ -167,6 +167,7 @@ The webhook got a response with status code *400*.""",
|
||||||
headers = {
|
headers = {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
"User-Agent": user_agent,
|
"User-Agent": user_agent,
|
||||||
|
"X-Smokescreen-Role": "webhook",
|
||||||
}
|
}
|
||||||
self.assertLessEqual(headers.items(), prepared_request.headers.items())
|
self.assertLessEqual(headers.items(), prepared_request.headers.items())
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue