jsdom get call is interpreted as image
Author: soniar4iCreated Nov 19, 2021Updated Sep 17, 2026
Labelsreal world problem
Basic info:
- Node.js version: 12.0.0
- jsdom version: ^18.0.1
Minimal reproduction case
I have the following jsdom with canvas as dependency
new JSDOM(
`<!DOCTYPE html>
<html>
<head>
<script src="https://www.sourceofjs.com/main.js"></script></head>
<body>
<p>My Test page</p>
</body>
</html>`,
{ runScripts: "dangerously", url: `${origin}`, origin: `${origin}`, pretendToBeVisual: true, virtualConsole: createVirtualConsole(), resources: "usable" }
);
This dom loads a js that loads and adds other external js (I can't control that external js) that executes some functions that modifies the DOM above and I'm getting an error when loading one of those resources as gets loaded as an image and gives me the following error:
Could not load img: "https://externalimageserver.com/v1/get/?qp=1&qp2=value" That server call returns 204 with empty response and I think that could be the key of the problem, but I'm not sure why it's getting interpreted as an image that js doesn't add that link as image.
How does similar code behave in browsers?
Performs the call and no errors occur.
Source: jsdom/jsdom