## Is your feature request related to a problem?

When sending incorrectly formatted payloads (e.g. a text-based string with a `gzip` compression header), the app will fail with a cryptic 500 error and register an unhandled exception.

## Describe the solution you'd like
The app should return a 400 bad request error, with details on why the request failed (i.e. it is incorrectly formatted or the content does not match the compression specified). In addition, this shouldn't be treated as an unhandled exception as it's a client error.


## Describe alternatives you've considered
Keep returning a cryptic 500 error.


## Additional context
Relevant context on #2701


#### *Thank you* for your feature request – we love each and every one!

posthog/api/capture.py
import re
from datetime import datetime
from typing import Any, Dict, Optional
import statsd
from dateutil import parser
from django.conf import settings
from django.http import JsonResponse
from django.utils import timezone
from django.views.decorators.csrf import csrf_exempt
from posthog.celery import app as celery_app
from posthog.ee import is_ee_enabled
from posthog.helpers.session_recording import preprocess_session_recording_events
from posthog.models import Team, User
from posthog.models.feature_flag import get_active_feature_flags
from posthog.models.utils import UUIDT
from posthog.utils import cors_response, get_ip_address, load_data_from_request
if settings.EE_AVAILABLE:
    from ee.clickhouse.process_event import log_event, process_event_ee
    from ee.kafka_client.topics import KAFKA_EVENTS_PLUGIN_INGESTION, KAFKA_EVENTS_WAL
def _datetime_from_seconds_or_millis(timestamp: str) -> datetime:
    if len(timestamp) > 11:  
        timestamp_number = float(timestamp) / 1000
    else:
        timestamp_number = int(timestamp)
    return datetime.fromtimestamp(timestamp_number, timezone.utc)
def _get_sent_at(data, request) -> Optional[datetime]: