- From: Luke Warlow <notifications@github.com>
- Date: Sat, 28 Nov 2026 07:12:58 -0800
- To: whatwg/xhr <xhr@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/xhr/issues/415@github.com>
lukewarlow created an issue (whatwg/xhr#415)
### What is the issue with the XMLHttpRequest Standard?
The spec is quite clear right now that if you have upload event listeners and then make e.g. a GET request, it will send a preflight request.
However, both Chromium and Servo do NOT fire these preflights if there's no request body. Neither seem a deliberate choice more a side effect of how they work around #242.
I couldn't find explicit test coverage for this scenario so that is at least needed.
However, part of me wonders if the chrome and servo behaviour is actually a bit nicer? There's no body so there's nothing to be revealed.
<details>
<summary>AI Generated Demo</summary>
index.html
```html
<!doctype html>
<meta charset="utf-8">
<title>XHR GET Preflight</title>
<p>Sends a cross-origin GET with no body and a listener on <code>xhr.upload</code>.
Check the server's terminal for a <code>PREFLIGHT</code> line.</p>
<script>
const xhr = new XMLHttpRequest();
xhr.open("GET", `http://127.0.0.1:8001/?t=${Date.now()}`);
xhr.upload.onprogress = () => {};
xhr.send();
</script>
```
Node server.js
```js
// Serves index.html on http://localhost:8000 and a CORS endpoint on http://127.0.0.1:8001
// (a different origin), logging every request the endpoint receives.
const http = require("http");
const fs = require("fs");
const path = require("path");
const port = 8000;
http.createServer((req, res) => {
res.writeHead(200, { "Content-Type": "text/html" });
fs.createReadStream(path.join(__dirname, "index.html")).pipe(res);
}).listen(port, "127.0.0.1");
http.createServer((req, res) => {
console.log(req.method === "OPTIONS" ? `PREFLIGHT ${req.url}` : `${req.method} ${req.url}`);
res.writeHead(req.method === "OPTIONS" ? 204 : 200, {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET",
"Access-Control-Max-Age": "0",
});
res.end();
}).listen(port + 1, "127.0.0.1");
console.log(`Open http://localhost:${port}`);
```
</details>
--
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/xhr/issues/415
You are receiving this because you are subscribed to this thread.
Message ID: <whatwg/xhr/issues/415@github.com>
Received on Saturday, 28 November 2026 15:13:02 UTC