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

[WEB] CORS error when accessing Entry API #39

Open
apripy opened this issue May 26, 2023 · 1 comment
Open

[WEB] CORS error when accessing Entry API #39

apripy opened this issue May 26, 2023 · 1 comment

Comments

@apripy
Copy link

apripy commented May 26, 2023

Describe the bug
With flutter web, I get a CORS error when using flusmic to query Prismic.
This is because the Dio instance is instantiated with contentType: "application/json" (line 18 of flusmic_repository.dart), changing it to "text/plain" avoid the CORS error.

To Reproduce
With flutter web:

    final flusmic = Flusmic(
        prismicEndpoint: 'https://your-repo-name.cdn.prismic.io/api/v2',
        defaultLanguage: s.localeName.toLowerCase().replaceAll("_", "-"));

    final response = await flusmic
        .query([Predicate.at(DefaultPredicatePath.id, 'legal_page')]);

Expected behavior
Retrieves the result of the query

Environment info (flutter doctor)
[✓] Flutter (Channel stable, 3.10.2, on macOS 13.2.1 22D68 darwin-arm64, locale
fr-FR)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
[✓] Chrome - develop for the web
Chrome Version 113.0.5672.92 (arm64)

Using flusmic 4.0.1, no relevant dependencies override

@andreock
Copy link

andreock commented Jul 7, 2023

https://github.com/Andrea055/flusmic Fixed in my fork if you need

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

No branches or pull requests

2 participants