Ability to set referrer policy on Map's transformRequest function
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
I am trying to implement url restrictions on a project using Mapbox. Our global referrer policy is set to "same-origin". In the transformRequest function, I'd like to be able to return a referrer policy for the fetch request. Right now if I add it to the request parameters it will not be included.
This is the Mapbox fetch request. I've tried setting it on the headers but that doesn't work. If I spread the requestParameters in, it does work (eg {...requestParameters} before method)
function makeFetchRequest(requestParameters , callback ) {
var controller = new window$1.AbortController();
var request = new window$1.Request(requestParameters.url, {
method: requestParameters.method || 'GET',
body: requestParameters.body,
credentials: requestParameters.credentials,
headers: requestParameters.headers,
referrer: getReferrer(),
signal: controller.signal
});
Can Mapbox add this as a supported parameter?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the makeFetchRequest entry point shown in the issue and trace how transformRequest request parameters become the Fetch Request options. Support a referrer policy parameter alongside the existing options, then verify that it is included in the constructed request and covered by the relevant request tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100