-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add option to exclude OPTIONS requests
These changes add a new optional parameter called `document_options` to the FlaskApiSpec constructor that will exclude OPTIONS requests from the swagger specification if set to `False`. Flask automatically generates OPTIONS requests for each route. There are cases, such as when using CORS, where one would want these OPTIONS requests to be generated but do not want to have them in their swagger docs. My line of reasoning for wanting to exclude these is: My API users will never explicitly make an OPTIONS request. The browser will automatically send a pre-flight OPTIONS request when making a cross-origin request, and I want to have OPTIONS endpoints in order to support that, but I don't want to have this functionality adding a bunch of endpoints to my swagger docs which will largely be ignored by users.
- Loading branch information
1 parent
535fc9d
commit d0cbe1a
Showing
2 changed files
with
14 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters