mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-15 12:53:41 +00:00
fix: preserve explicit Cookie headers in extension requests
This commit is contained in:
1 parent
ba84a04a43
commit
fe2f45e40d
4 files changed
+114
-3
No files matched your search
@@ -110,7 +110,19 @@ func runWPTFile(t *testing.T, files embed.FS, name, setup string) {
|
||||
}
|
||||
runtime := engine.NewEngine(nil)
|
||||
t.Cleanup(runtime.Close)
|
||||
value, err := runtime.RunString(setup + "\n" + wptHarness + "\n" + wptFetchUtils + "\n" + wptRequestError + "\n" + string(source) + "\n__wptFinish();")
|
||||
adaptation := ""
|
||||
if name == "testdata/wpt/fetch/api/request/request-headers.any.js" {
|
||||
// Gopeed extensions intentionally allow explicit Cookie request headers.
|
||||
// Keep the upstream file unchanged and exclude only its browser restriction.
|
||||
adaptation = `
|
||||
const upstreamTest = globalThis.test;
|
||||
globalThis.test = function (callback, name) {
|
||||
if (name === 'Adding invalid request header "Cookie: KO"') return;
|
||||
upstreamTest(callback, name);
|
||||
};
|
||||
`
|
||||
}
|
||||
value, err := runtime.RunString(setup + "\n" + wptHarness + "\n" + wptFetchUtils + "\n" + wptRequestError + "\n" + adaptation + "\n" + string(source) + "\n__wptFinish();")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user