hugomrdias / playwright-test

Run unit tests with several test runners or benchmark inside real browsers with playwright and other Javascript runtimes.
MIT License
100 stars 12 forks source link

fix: allow loading gzipped fixtures #644

Closed achingbrain closed 9 months ago

achingbrain commented 9 months ago

Description

When loading a file that ends in .gz, sirv will set the Content-Encoding header to gzip which means browsers will unzip the content before handing it back to fetch or XMLHttpRequest.

This PR adds a workaround to the asset server that sets the header to a garbage value if a file ending in .gz has been requested.

It's necessary to use a garbage value because sirv sets the headers after the setHeaders function passed to it's config has been invoked, and it will only not set the header if one has been set already.

Link to issue

Type of change

Please delete options that are not relevant.