• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

telefonicaid / fiware-pep-steelskin / 11256688872

09 Oct 2024 02:06PM UTC coverage: 78.988% (-3.8%) from 82.787%
11256688872

Pull #544

github

web-flow
Merge 8bdd7b564 into 2c45e28dd
Pull Request #544: Task/add access matches (about users, headers, path. .. ) to access Logger

266 of 378 branches covered (70.37%)

Branch coverage included in aggregate %.

19 of 57 new or added lines in 4 files covered. (33.33%)

20 existing lines in 2 files now uncovered.

764 of 926 relevant lines covered (82.51%)

50.04 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

89.47
/lib/plugins/restPlugin.js
1
/*
2
 * Copyright 2014 Telefonica Investigación y Desarrollo, S.A.U
3
 *
4
 * This file is part of fiware-pep-steelskin
5
 *
6
 * fiware-pep-steelskin is free software: you can redistribute it and/or
7
 * modify it under the terms of the GNU Affero General Public License as
8
 * published by the Free Software Foundation, either version 3 of the License,
9
 * or (at your option) any later version.
10
 *
11
 * fiware-pep-steelskin is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14
 * See the GNU Affero General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU Affero General Public
17
 * License along with fiware-pep-steelskin.
18
 * If not, seehttp://www.gnu.org/licenses/.
19
 *
20
 * For those usages not covered by the GNU Affero General Public License
21
 * please contact with::[iot_support@tid.es]
22
 */
23

24
'use strict';
25

26
/**
27
 * Determines what is the requested action based on the request methods.
28
 *
29
 * @param {Object}   req           Incoming request.
30
 * @param {Object}   res           Outgoing response.
31
 * @param {Function} next          Callback for calling the next middleware. This callback should adhere to the
32
 *                                 following signature: next(error, req, res) where req and res are the received
33
 *                                 parameters and error is an Error object in case the request should be rejected
34
 *                                 or null otherwise.
35
 */
36
function extractAction(req, res, next) {
1✔
37
    switch (req.method) {
14!
38
        case 'POST':
39
            req.action = 'create';
3✔
40
            break;
3✔
41
        case 'DELETE':
42
            req.action = 'delete';
3✔
43
            break;
3✔
44
        case 'PUT':
45
            req.action = 'update';
3✔
46
            break;
3✔
47
        case 'GET':
48
            req.action = 'read';
5✔
49
            break;
5✔
50
        default:
51
            req.action = null;
×
52
    }
53

54
    req.resourceUrl = req.path;
14✔
55

56
    next(null, req, res);
14✔
57
}
58

59
exports.extractAction = extractAction;
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc