I'm getting an error
XMLHttpRequest cannot load https://my-api.domain.com. Origin file:// is not allowed by Access-Control-Allow-Origin.
when I try to run some async unit tests that query an API through grunt-contrib-jasmine, which in turn using PhantomJS. I see that the command line version of PhantomJS does have a 'web-security' options. Can I control how grunt-contrib-jasmine uses PhantomJS to include this option and disable the cross-domain security?
You can pass options to phantomjs similarly to how you would on the command line, e.g.
The following options may help, but more can be found at the phantomjs docs
jasmine : {
your_task : {
options : {
'--web-security' : false,
'--local-to-remote-url-access' : true,
'--ignore-ssl-errors' : true
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With