Closed tommedema closed 6 years ago
It's weird how it can say Not found, skipping: assets/css-root-path.css
when fauxJax.on( "request", ...)
is never even fired.
What's also weird is that when I specify strict: true
, the callback is called without an error argument.
Note that I'm working from the latest master branch (i.e. no other local changes other than the test file).
Got it
requestTransform: function( options )
{
console.log('request transform');
console.log(options);
}
Should be
requestTransform: function( options )
{
console.log('request transform');
console.log(options);
return options;
}
the not found error is not descriptive, but there are bigger fish to catch
I'm trying to fix a bug where paths to resources specified in css files are resolved incorrectly when they are absolute root paths, such as
/image.png
instead ofimage.png
or./image.png
.Currently there is a bug in this scenario:
assets/main.css
:<link href="assets/css-root-path.css" rel="stylesheet">
assets/main.css
has a background image withurl(/image.png)
(notice the prefix of/
)The background image is now resolved to
http://www.example.com/assets/image.png
whereas obviously it should resolve to the root domain i.e.http://www.example.com/image.png
due to the preceding/
.I'm trying to make a PR to fix this, but am experiencing unexpected behavior when mocking http requests with fauxJax. I created the following test:
requestTransform
is fired with an expected uri ofhttp://example.com/assets/css-root-path.css
. This is normal.What is not normal is that fauxJax.on("request" is never fired. I.e. there is no log line from
console.log('faux request %j', request)
The complete output is:
@jrit Do you understand why
fauxJax.on( "request", ...
is not firing? I need to dig into this method to see whyassets/css-root-path.css
is not found (404), even though it is in the specified folder and should be mocked by fauxJax.