Skip to content
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 capturing json event data with content-type text/plain #2648

Merged
merged 1 commit into from
Dec 3, 2020

Conversation

macobo
Copy link
Contributor

@macobo macobo commented Dec 3, 2020

Supports change made in PostHog/posthog-js#144

Checklist

  • All querysets/queries filter by Organization, by Team, and by User
  • Django backend tests
  • Jest frontend tests
  • Cypress end-to-end tests

@timgl timgl temporarily deployed to posthog-capture-support-sqtckv December 3, 2020 11:10 Inactive
@macobo macobo marked this pull request as ready for review December 3, 2020 12:15
@macobo macobo requested a review from paolodamico December 3, 2020 12:15
@@ -310,6 +310,8 @@ def load_data_from_request(request):
data_res["body"] = {**json.loads(request.body)}
except:
pass
elif request.content_type == "text/plain":
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a ton of tests relating to encoding issues. Would be good to port those over for this.

Also not sure I understand text/plain if it's json?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some context for this is under PostHog/posthog-js#144

We have a ton of tests relating to encoding issues. Would be good to port those over for this.

Agreed. However I'd like to briefly roll this out, see whether this fixes session recording metrics or not for us and then do that. It might turn out that it doesn't help and we'll just roll this back or we might end up going for a different compression scheme.

Note also this change should only affect our team: context under PostHog/posthog-js#144

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgot to mention why text/plain for json: CORS. content-type: application/json is considered a custom header and results in every xhr doing 2 queries: OPTIONS + POST

Copy link
Contributor

@paolodamico paolodamico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good as a quick test for our team, we can add more tests if it proves useful to keep it permanent.

@paolodamico paolodamico merged commit 2c40a4a into master Dec 3, 2020
@paolodamico paolodamico deleted the capture-support-text-plain branch December 3, 2020 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants