koa-health / mixpanel_analytics

A dart wrapper on the mixpanel REST API to be used in Flutter applications.
https://pub.dev/packages/mixpanel_analytics
MIT License
19 stars 26 forks source link

Fix CORS problem on Flutter Web #20

Closed HaoCherHong closed 3 years ago

HaoCherHong commented 3 years ago

Fix the following error on browsers

Access to XMLHttpRequest at 'https://api.mixpanel.com/track/?data=...&verbose=1&ip=0' from origin 'https://some.domain' has been blocked by CORS policy: Request header field content-type is not allowed by Access-Control-Allow-Headers in preflight response.

Changes: Remove 'Content-type' header from GET requests

HaoCherHong commented 3 years ago

This should fix problem described in #5

robertohuertasm commented 3 years ago

Hi @HaoCherHong thanks for this PR. I've tested it and it seems to be working! 🙌🏻