inversify-express-utils
inversify-express-utils copied to clipboard
Add @httpOptions decorator to handle OPTIONS HTTP method.
This PR adds the @httpOptions decorator to handle OPTIONS request more easily, it was also documented to show other developers that it is available to use.
Description
Adds a @httpOptions decorator in the same pattern as other decorators. Adds in README.md an example of how to use it and why.
Related Issue
Motivation and Context
I thought about this because I implemented a CORS middleware and had some trouble to deal with it.when making a request from the browser. So, I'd like to contribute to help other developers to not get stuck like me. This PR is just the first step.
How Has This Been Tested?
The unit tests were written following the same pattern as the other HTTP methods tests.
Types of changes
- [ ] Bug fix (non-breaking change which fixes an issue)
- [X] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
Checklist:
- [X] My code follows the code style of this project.
- [X] My change requires a change to the documentation.
- [X] I have updated the documentation accordingly.
- [X] I have read the CONTRIBUTING document.
- [X] I have added tests to cover my changes.
- [X] All new and existing tests passed.