instana / weasel

Gather end-user browser performance data
https://www.instana.com
MIT License
40 stars 5 forks source link

Deep copy init object of Fetch instead of modifying the original one #123

Closed zhouhn-ibm closed 1 year ago

zhouhn-ibm commented 1 year ago

WHY: In some rare cases, a global variable is passed through as options of Fetch API. Then weasel modifies the type of headers in the parameter to Headers object during appending Instana correlation header. This case changes the type of a global variable and might cause conflict with further user cases.

Using a deep copy of options of Fetch and keeping the input one untouched is more safe.

WHAT: Update hook of Fetch API to use deep copy of Fetch options.