Skip to content

[WEB] CORS error when accessing Entry API #39

@apripy

Description

@apripy

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions