Is there a possibillity to force the usage of the polyfill instead of the browser functionality?
No, the polyfill cannot be forced to override native browser behavior. See #147 and #162 for more discussion.
This would be a very nice feature to have available somehow, even if it meant digging deep into internals. We are seeing non-spec-compliant behavior from Edge, such as #407 and missing request bodies on DELETE. For now we will simply fork.
Native fetch also don't have support for response.body which the polyfill soon dose (once #404 gets accepted), So I agree that it would be useful to enforce the polyfill in browser that partially support fetch.
I understand that the team doesn't want to introduce a build process or otherwise complicate this module, but given that we've now seen our first fundamentally broken fetch() implementation in the wild, it may be necessary.
I don't believe it's going to be possible to easily test for the broken PUT/PATCH/DELETE Content-Length functionality, so it would be really nice to have a UMD shim introduced.
I would have to agree that the polyfill should not be implementing functionality for forcing usage. You can easily force usage of any polyfill in other ways. I recently had to get around a bug in MS Edge fetch implementation where it wasn't handling 401 responses correctly. My solution was just to unset window.fetch for MS Edge. After that, the polyfill worked as expected and set window.fetch to the polyfill version.
In the first <script> tag of the <head> section
if (navigator.userAgent.indexOf('Edge') !== -1) {
window.fetch = undefined;
}
as long as that is executed before the fetch polyfill code, you're golden.
Most helpful comment
I would have to agree that the polyfill should not be implementing functionality for forcing usage. You can easily force usage of any polyfill in other ways. I recently had to get around a bug in MS Edge fetch implementation where it wasn't handling 401 responses correctly. My solution was just to unset window.fetch for MS Edge. After that, the polyfill worked as expected and set window.fetch to the polyfill version.
In the first
<script>tag of the<head>sectionas long as that is executed before the fetch polyfill code, you're golden.