Comments (3)
Hi @kariem,
The server automatically handle the OPTIONS method because it is usually used for front-end development, and these requests are automatically done by the browsers, so I thought it would be useful to not have to add those routes manually always. But you're right, in some scenarios it may be desirable to disable this behaviour and handle them manually.
Another problem is that there is no mention in the documentation about it, so I will try to publish a new version as soon as possible including an option to disable the built-in CORS middleware, and mention it in the docs.
For the moment, as a workaround, if you are modifying the code by yourself, you could also disable the CORS middleware removing the line this._express.use(middlewares.enableCors);
in the src/server/Server.js
file. But I hope to have a new release with this fix this week.
Thanks for your feedback! 🙂
from core.
Hi again @kariem!
The version 2.1.0 is already released, and the docs were also updated. Now it supports OPTIONS, HEAD and TRACE methods, and it has two new options allowing to disable both CORS headers and CORS pre-flight responses separately. You can read the "how to use the OPTIONS method" section in the documentation for further info.
I hope it might help,
Thanks again for your feedback! 🙂
from core.
Hi @javierbrea,
Thank you very much for the quick update!
Just tested 2.1.0 with the adapted configuration and it works well.
Thank you!
from core.
Related Issues (20)
- Improve traces when defining a behavior extending from a non-existing one HOT 1
- Validate mocks, routes and route variants format
- Improve traces handling HOT 1
- Add option for adding middlewares
- Emit `onInit` and `onStart` events HOT 1
- Negative options format
- New format for defining fixtures and behaviors
- Stricter folders and files structure
- Support array of methods in route variants
- Typescript support HOT 3
- Provide core methods to fixtures express middlewares
- Control over headers
- Handle Form Post HOT 1
- Add fixtures handlers using the config file
- File names conflict
- Dependency Dashboard
- Support Nodejs 14.x HOT 1
- FilesLoader error shouldn't be masked HOT 1
- Delay option to fixtures
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from core.