weaver.wps_restapi.patches
¶
Module Contents¶
-
class
weaver.wps_restapi.patches.
NoAutoHeadList
[source]¶ List that does not allow addition of HTTP HEAD method object references unless allowed once.
Initialize self. See help(type(self)) for accurate signature.
-
class
weaver.wps_restapi.patches.
ServiceOnlyExplicitGetHead
(*_: Any, **__)[source]¶ Service that disallow the auto-insertion of HTTP HEAD method view when HTTP GET view is defined.
This service overrides the default
cornice.Service
in order to avoid auto-insertion of HTTP HEAD view. Similarly topyramid
, the view registration assume that HEAD are always wanted when adding GET definitions. Because HEAD view can be added explicitly, the class also detects these cases to let them pass as expected.Without this patch, all endpoint would otherwise report erroneous HEAD requests in the generated OpenAPI specification once HEAD is removed from
cornice_swagger.CorniceSwagger.ignore_methods
.See also
HEAD method removed from ignored methods in
weaver.wps_restapi.api.get_openapi_json()
.HEAD method auto-insertion disabled for
pyramid
inpatch_pyramid_view_no_auto_head_get_method()
.
-
add_view
(self: Union[str, Tuple[str]], method: Any, view: Any, **kwargs) → None[source]¶ Add a view to a method and arguments.
All the
Service
keyword params except name and path can be overwritten here. Additionally,api()
has following keyword params:- Parameters
method – The request method. Should be one of ‘GET’, ‘POST’, ‘PUT’, ‘DELETE’, ‘OPTIONS’, ‘TRACE’, or ‘CONNECT’.
view – the view to hook to
**kwargs –
additional configuration for this view, including permission.