List that does not allow addition of HTTP HEAD method object references unless allowed once.
Initialize self. See help(type(self)) for accurate signature.
ServiceOnlyExplicitGetHead(*_: 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(self: Union[str, Tuple[str]], method: Any, view: Any, **kwargs) → 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.
RequestMethodPredicateNoGetHead(val: pyramid.config.Configurator, config)¶