Skip to content

Fix fetch polyfill to pass the original request input - #545

Merged
ystefinko merged 1 commit into
heremaps:masterfrom
mattiasnixell:fix-fetch-polyfill-default-behavior
Nov 13, 2026
Merged

ystefinko merged 1 commit into
heremaps:masterfrom
mattiasnixell:fix-fetch-polyfill-default-behavior

Conversation

@mattiasnixell

@mattiasnixell mattiasnixell commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

The current polyfill only passes the URL if a request object is used in the fetch call. It should pass the original request input so that headers and other request values are not removed.

Example

const request = new Request("http://localhost/api", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ userId: 1 }),
});

const response = await fetch(request);

The above code sends a GET http://localhost/api without the headers and body in a codebase with HERE SDK imported.

Solution

If the protocol is not file://, pass the original request input to fetch instead of the extracted URL.

The current polyfill only passes the URL if a request object is used in the fetch call. It should pass the original request input so that headers and other request values are not removed.

Signed-off-by: Mattias Nixell <mattias.nixell@gmail.com>
@mattiasnixell
mattiasnixell force-pushed the fix-fetch-polyfill-default-behavior branch from 4202764 to ca9c08d Compare October 22, 2026 07:07
@OleksiiZubko OleksiiZubko self-assigned this Nov 11, 2026
@codecov

codecov Bot commented Nov 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.7196%. Comparing base (cbd7c57) to head (ca9c08d).

Additional details and impacted files
@@             Coverage Diff             @@
##             master       #545   +/-   ##
===========================================
  Coverage   91.7196%   91.7196%           
===========================================
  Files            86         86           
  Lines          2838       2838           
  Branches        398        398           
===========================================
  Hits           2603       2603           
  Misses           90         90           
  Partials        145        145           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@OleksiiZubko

Copy link
Copy Markdown
Collaborator

Hi @mattiasnixell, thanks for your contribution! The fix looks solid, and I'll include it in the upcoming release.
Could you please update the commit message so it passes our commit linter? You can check our commit guidelines here: https://github.com/heremaps/here-data-sdk-typescript/blob/master/scripts/misc/commit_message_recom.txt
Please use HERESUP-105459 for the Relates-To: trailer.

@ystefinko
ystefinko merged commit 84f187c into heremaps:master Nov 13, 2026
5 of 9 checks passed
OleksiiZubko added a commit that referenced this pull request Nov 13, 2026
Fix fetch polyfill to pass the original request input (#545)

Relates-To: HERESUP-105459

Signed-off-by: Oleksii Zubko <ext-oleksii.zubko@here.com>
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

Successfully merging this pull request may close these issues.

3 participants