Test webhook endpoint. Returns: True if reachable
(self)
| 225 | async def test_connection(self) -> bool: |
| 226 | """Test webhook endpoint. |
| 227 | |
| 228 | Returns: |
| 229 | True if reachable |
| 230 | """ |
| 231 | try: |
| 232 | async with httpx.AsyncClient(timeout=self.timeout) as client: |
| 233 | # Send a test/ping request |
| 234 | if self.format == "slack": |
| 235 | # Slack accepts empty payload for testing |
| 236 | response = await client.post( |
| 237 | self.url, |
| 238 | json={"text": "Security Suite connection test"}, |
| 239 | headers=self._get_headers(), |
| 240 | ) |
| 241 | else: |
| 242 | # Just check if endpoint is reachable |
| 243 | response = await client.head(self.url) |
| 244 | |
| 245 | return response.status_code < 500 |
| 246 | |
| 247 | except Exception as e: |
| 248 | self.logger.error(f"Webhook test failed: {e}") |
| 249 | return False |
| 250 | |
| 251 | def get_config_info(self) -> dict: |
| 252 | """Get exporter configuration info.""" |
| 253 | return { |
| 254 | "type": "webhook", |
no test coverage detected