* Checks if client IP address is allowed to make http request to * S3 server. Defines function 'montiroingEndHandler', which is * called if IP not allowed or passed as callback. * @param {string | undefined} clientIP - IP address of client * @param {http.IncomingMessage} req - http request objec
(clientIP, req, res, log)
| 252 | * @return {void} |
| 253 | */ |
| 254 | function monitoringHandler(clientIP, req, res, log) { |
| 255 | function monitoringEndHandler(err, results) { |
| 256 | writeResponse(res, err, results, error => { |
| 257 | if (error) { |
| 258 | return log.end().warn('monitoring error', { err: error }); |
| 259 | } |
| 260 | return log.end(); |
| 261 | }); |
| 262 | } |
| 263 | if (req.method !== 'GET') { |
| 264 | return monitoringEndHandler(errors.MethodNotAllowed, []); |
| 265 | } |
| 266 | if (req.url !== '/metrics') { |
| 267 | return monitoringEndHandler(errors.MethodNotAllowed, []); |
| 268 | } |
| 269 | return routeHandler(req, res, monitoringEndHandler); |
| 270 | } |
| 271 | |
| 272 | module.exports = { |
| 273 | monitoringHandler, |
nothing calls this directly
no test coverage detected