Skip to content

Add option to set request mode for fetch API #13676

Description

@andreasa-winenet

Motivation

It is not strictly necessary in most cases, but if I know I only use URLs from the same-origin it can be better to use mode: 'same-security' for fetch requests to block cross origin requests altogether.

It isn't strictly necessary but it could be used to avoid accidentally calling CORS URLs

Implementation

In https://github.com/mapbox/mapbox-gl-js/blob/v3.24.0/src/util/ajax.ts#L118 add an option to also provide mode similar to cache mode etc.

See also https://developer.mozilla.org/en-US/docs/Web/API/Request/mode and https://developer.mozilla.org/en-US/docs/Web/API/RequestInit#mode

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions