| Total Complexity | 0 |
| Complexity/F | 0 |
| Lines of Code | 35 |
| Function Count | 0 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | "use strict"; |
||
| 2 | |||
| 3 | const Joi = require('joi'); |
||
| 4 | |||
| 5 | module.exports = Joi.object() |
||
| 6 | .keys({ |
||
| 7 | method: Joi.string() |
||
| 8 | .allow(['GET', 'POST', 'PUT', 'DELETE', 'PATCH']) |
||
| 9 | .default('GET'), |
||
| 10 | uri: Joi.string() |
||
| 11 | .uri({ |
||
| 12 | scheme: [/https?/] |
||
| 13 | }) |
||
| 14 | .required(), |
||
| 15 | payload: Joi.when('json', { |
||
| 16 | is: true, |
||
| 17 | then: Joi.alternatives().try(Joi.object(), Joi.array()), |
||
| 18 | otherwise: Joi.string() |
||
| 19 | }), |
||
| 20 | queryString: Joi.object(), |
||
| 21 | headers: Joi.object(), |
||
| 22 | form: Joi.alternatives().try(Joi.object(), Joi.array()), |
||
| 23 | json: Joi.boolean() |
||
| 24 | .default(true) |
||
| 25 | }) |
||
| 26 | .example({ |
||
| 27 | method: 'GET', |
||
| 28 | uri: 'http://url.com', |
||
| 29 | payload: {}, |
||
| 30 | queryString: {}, |
||
| 31 | headers: {}, |
||
| 32 | form: {}, |
||
| 33 | json: true |
||
| 34 | }) |
||
| 35 | ; |
||
| 36 |