Repository navigation
Test identity encoding for range requests - #11291
Conversation
| promise_test(async t => { | ||
| await loadScript('resources/partial-script.py?pretend-offset=90000'); | ||
| assert_true(self.scriptExecuted); | ||
| }, `Script executed from partial response`); |
There was a problem hiding this comment.
This test already existed, but I renamed the file and git didn't realise.
| await fetch(event.request); | ||
| const response = await fetch('stash-take.py?key=' + key); | ||
| assert_equals(await response.json(), '"range-header-received"'); | ||
| assert_equals(await response.json(), 'range-header-received'); |
There was a problem hiding this comment.
Bug-fixing an existing test.
| audio.preload = true; | ||
| document.body.appendChild(audio); | ||
| } | ||
| const BASE_SCOPE = 'resources/basic.html?'; |
There was a problem hiding this comment.
I'm now generating a unique scope for each test, it avoid the old service worker coming back from the dead in Safari.
annevk
left a comment
There was a problem hiding this comment.
I don't see anything that I know to be wrong, but I have a couple minor questions.
| request.server.stash.take( | ||
| accept_encoding_key, | ||
| '/fetch/range/' | ||
| ) |
There was a problem hiding this comment.
Safari appears to make two requests in quick succession. Without this, an error is thrown, since it tries to put something in the stash when that key already exists.
| response.headers.set("Cache-Control", "no-cache") | ||
|
|
||
| range_header = request.headers.get('Range', '') | ||
| range_header_match = range_header and re.search(r'^bytes=(\d*)-(\d*)$', range_header) |
There was a problem hiding this comment.
So this is either None (or False?) or a regular expression result?
Tests for whatwg/fetch#751.