-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support gzip encoding from posthog-js #2701
Conversation
This is subtly different from `gzip` since it requires text/plain encoding (we can't send application/json due to CORS). We need a separate name for this because of this as older versions of posthog don't support text/plain
@@ -155,6 +155,24 @@ def test_emojis_in_text(self, patch_process_event_with_plugins): | |||
"💻 Writing code", | |||
) | |||
|
|||
@patch("posthog.models.team.TEAM_CACHE", {}) | |||
@patch("posthog.api.capture.celery_app.send_task") | |||
def test_js_gzip(self, patch_process_event_with_plugins): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe worth adding a test for an incorrectly formatted payload with gzip-js
to make sure it's handled gracefully?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question. Unsure what the expected behavior here is - silently eating errors in the util would lead to problems elsewhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm making a proposal change for this, will just make sure a proper error response is returned instead of a cryptic 500
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Never mind, as the /capture
endpoint is not on DRF, handling the exception requires a more comprehensive refactor, tabling this for now into a separate issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm! just added a few test assertions to include the compression algorithms.
Companion PR: PostHog/posthog-js#151
Checklist