hapi-swaggered
hapi-swaggered copied to clipboard
Automatically generate HEAD methods (option)
As Hapi.js automatically generates HEAD routes for every GET (and based on GET decides what to return), would be cool to allow displaying them, on:
- global basis (in plugin config object)
- per route basis (
config.plugins['hapi-swaggered'].displayHead = true) - this should check ifroute.method === GETand if not, ignore (or let user know he's doing something wrong). IfdisplayHead=== false - should overwrite global configuration
Source: https://github.com/hapijs/hapi/issues/795
Especially
HEAD is created automatically for every GET you define
and
If you want to optimize your handling of HEAD requests, simply check your GET handler for the method, and if it is 'head', return an empty response with the correct headers. This is only worth doing for some very expensive GET requests, where you are expecting clients to use HEAD directly.
By spec, no payload allowed.
Authentication is the same so HEAD should inherit all GET properties (scope, authentication scheme, error codes) and so on