-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: Cross origin http://localhost forbidden #1754
Comments
Possible duplicated: #1418 |
Thanks @OpenGG . adding |
I also had this problem. This thread led me to this part of the Jest docs. I was able to fix the issue by pasting: /**
* @jest-environment node
*/ At the top of my test file. FWIW, adding: {
// ...
"testEnvironment": "node"
//...
} to either |
really thanks, this solves my problem |
I solved this problem with the answer in the link below. |
thanks very much! I use it in {
"scripts": {
"test": "jest --env=node"
}
} |
I don't think the solution above is complete, often you will actually want to run your tests in the jsdom environment, if testing UI |
If using jest, users can set testURL to avoid CORS problem. |
My jest.config.js resolves this issue (note testEnvironment without quotes): |
Adding anything in my jest config was making other tests fail so adding the line below to my beforeAll function in my tests and it fixed the CORS error.
|
Added testEnvironment variable in the Jest.config file within module.exports It resolved the issue. |
Fixes an issue related to axios/axios#1754
Hi All,
I've got lambda function which I access via API Gateway.
This function works ok when I test it via Postman or via this test which uses
request
library:Problem
Unfortunately, when I'm using Axis I get following message Error: Cross origin http://localhost forbidden.
Could you please tell me what am I doing wrong?
My code looks like that:
Context
The text was updated successfully, but these errors were encountered: