Failed Conditions
Pull Request — master (#2)
by Yo
01:30
created

Request.js ➔ ???   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1.037

Importance

Changes 8
Bugs 0 Features 0
Metric Value
cc 1
c 8
b 0
f 0
nc 1
nop 7
dl 0
loc 9
rs 9.6666
ccs 6
cts 9
cp 0.6667
crap 1.037
1
"use strict";
2
3
class Request {
4
    /**
5
     * @param {string}  uri
6
     * @param {string}  method
7
     * @param {Object}  payload
8
     * @param {Object}  queryString
9
     * @param {Object}  headers
10
     * @param {Object}  form
11
     * @param {boolean} json
12
     */
13
    constructor(uri, method = 'GET', payload = {}, queryString = {}, headers = {}, form = {}, json = true) {
14
        this.uri = uri;
15 10
        this.method = method;
16 10
        this.payload = payload;
17 10
        this.queryString = queryString;
18 10
        this.headers = headers;
19 10
        this.form = form;
20 10
        this.json = json;
21
    }
22
23
    /**
24
     * @public
25
     * @returns {string}
26
     */
27
    getUri() {
28
        return this.uri;
29
    }
30
31
    /**
32
     * @public
33
     * @returns {Object}
34
     */
35
    getPayload() {
36
        return this.payload;
37
    }
38
39
    /**
40
     * @public
41
     * @returns {Object}
42
     */
43
    getQueryString() {
44
        return this.queryString;
45
    }
46
47
    /**
48
     * @public
49
     * @returns {Object}
50
     */
51
    getHeaders() {
52
        return this.headers;
53
    }
54
55
    /**
56
     * @public
57
     * @returns {string}
58
     */
59
    getMethod() {
60
        return this.method;
61
    }
62
63
    /**
64
     * @public
65
     * @returns {Object}
66
     */
67
    getForm() {
68
        return this.form;
69
    }
70
71
    /**
72
     * @public
73
     * @returns {boolean}
74
     */
75
    isJson() {
76
        return this.json;
77
    }
78
}
79
80
module.exports = Request;
81