- class weaver.wps_restapi.patches.NoAutoHeadList
List that does not allow addition of HTTP HEAD method object references unless allowed once.
Initialize self. See help(type(self)) for accurate signature.
- allow_once = False
- class weaver.wps_restapi.patches.ServiceOnlyExplicitGetHead(*_: Any, **__: Any)
Service that disallow the auto-insertion of HTTP HEAD method view when HTTP GET view is defined.
This service overrides the default
cornice.Servicein order to avoid auto-insertion of HTTP HEAD view. Similarly to
pyramid, 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
- add_view(method: str | Tuple[str], view: Any, **kwargs: Any) None
Add a view to a method and arguments.
Servicekeyword params except name and path can be overwritten here. Additionally,
api()has following keyword params:
method – The request method. Should be one of ‘GET’, ‘POST’, ‘PUT’, ‘DELETE’, ‘OPTIONS’, ‘TRACE’, or ‘CONNECT’.
view – the view to hook to
additional configuration for this view, including permission.
- class weaver.wps_restapi.patches.RequestMethodPredicateNoGetHead(val: str | Tuple[str], config: pyramid.config.Configurator)