## 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/decide.py
import json
import secrets
from typing import Any, Dict, Optional, Tuple
from urllib.parse import urlparse
from django.conf import settings
from django.http import HttpRequest, JsonResponse
from django.views.decorators.csrf import csrf_exempt
from posthog.models import Team, User
from posthog.models.feature_flag import get_active_feature_flags
from posthog.utils import cors_response, load_data_from_request
from .capture import _get_project_id, _get_token
def on_permitted_domain(team: Team, request: HttpRequest) -> bool: