Closed karpikpl closed 6 years ago
My application has some custom required headers, I would like to include them in the documentation /docs.
/docs
Here's the code:
const Hapi = require('hapi'); const Joi = require('joi'); const startServer = async () => { try { const server = Hapi.server({ port: 8088 }); await server.register([require('vision'), require('inert'), require('lout')]); server.route({ method: 'GET', path: '/hello', handler: () => 'hello', options: { validate: { query: { foo: Joi.any().valid('bar','foo').required(), }, headers: Joi.object({ 'x-request-id': Joi.string().guid().required(), }).options({ allowUnknown: true }) } } }); await server.start(); console.log('Server running at:', server.info.uri); } catch (err) { console.error(err); process.exit(1); } }; startServer();
curl command:
$ curl ".:8088/hello?foo=bar" -H "x-request-id:452842F4-D331-45BC-9532-EC05D1F3F108" hello%
but documentation doesn't list anything about the headers:
It's just something nobody ever asked. Added support for it in the latest version.
Thanks!
My application has some custom required headers, I would like to include them in the documentation
/docs
.Here's the code:
curl command:
but documentation doesn't list anything about the headers: