Hi community,
Our dev team and some clients have noticed an issue recently with PATCH requests being sent from a UI::HtmlDialog using SketchUp 2024.
When making a simple PATCH request with a simple body: it looks like the request itself is sent out OK from the client perspective but when the request reaches the targeted endpoint, there doesn’t appear to be any body.
We are able to consistently reproduce this issue on the SketchUp 2024.0.553 64-bit build on Windows 10.
This issue cannot be reproduced in SketchUp 2022 or SketchUp 2023, or in environments outside of SketchUp such as in Chrome and postman.
Steps to reproduce
To reproduce, I’d recommend that you create and launch a quick express server (or similar), with the following code:
const express = require('express');
const app = express();
app.use(express.text());
app.patch('/', (req, res) => {
console.log('about to log body');
console.log(req.body);
console.log('finished logging body');
res.send('Finished patch');
});
app.listen(3000, () => {
console.log(`Example app listening at http://localhost:${port}`);
});
Now open SketchUp 2024 and in an HtmlDialog, try to run the following code from the console in the devtools:
await fetch('http://localhost:3000', { method: 'PATCH', body: 'test string' })
Notice that in the network tab, you’ll see that there is actually a payload with the request. However, when it gets to the express server, observe the following output:
Example app listening at http://localhost:3000
about to log body
{}
finished logging body
If you try to make the same request in SketchUp 2023 or SketchUp 2022 (or even with postman or in chrome (note, for chrome you’ll need to add cors support to the server)), you’ll see the following as expected:
Example app listening at http://localhost:3000
about to log body
test string
finished logging body
I should note, that we have tested using both the Fetch and XmlHttpRequest APIs and both implementations give the same problem in SU2024 (and both work in previous versions). I should also note that we have tested making a simple PATCH request from SU2024 with various different servers and we can also reproduce the problem using those servers.