* Handle a GET request. * * @param {Object} req The request object * @param {Object} res The response object
(req: express.Request, res: express.Response)
| 360 | * @param {Object} res The response object |
| 361 | */ |
| 362 | get(req: express.Request, res: express.Response): void { |
| 363 | const thing = this.getThing(req); |
| 364 | if (thing === null) { |
| 365 | res.status(404).end(); |
| 366 | return; |
| 367 | } |
| 368 | |
| 369 | const propertyName = req.params.propertyName; |
| 370 | if (thing.hasProperty(propertyName)) { |
| 371 | res.json({[propertyName]: thing.getProperty(propertyName)}); |
| 372 | } else { |
| 373 | res.status(404).end(); |
| 374 | } |
| 375 | } |
| 376 | |
| 377 | /** |
| 378 | * Handle a PUT request. |
no test coverage detected