xs/Response.xsi

filter: Statementstmt 0.0% 0 / 32 Branchbran 0.0% 0 / 76 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 0.0% 0 / 108 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« xs/RequestParser.xsi ↑ Summary xs/ResponseParser.xsi »
1 MODULE = Protocol::HTTP PACKAGE = Protocol::HTTP::Response
2 PROTOTYPES: DISABLE
3
4 BOOT {
5 0 ▶ Stash s(__PACKAGE__);
Branch: 1 branch
BranchTrueFalseTotal
Stash s(__PACKAGE__); 0 0 0
6 0 ▶ s.inherit("Protocol::HTTP::Message");
Branch: 1 branch
BranchTrueFalseTotal
s.inherit("Protocol::HTTP::Message"); 0 0 0
7 0 ▶ xs::exp::create_constants(s, {
Branch: 4 branches
BranchTrueFalseTotal
xs::exp::create_constants(s, { 0 0 0
xs::exp::create_constants(s, { 0 0 0
xs::exp::create_constants(s, { 0 0 0
xs::exp::create_constants(s, { 0 0 0
8 {"COOKIE_SAMESITE_DISABLED", int(Response::Cookie::SameSite::disabled)},
9 {"COOKIE_SAMESITE_STRICT", int(Response::Cookie::SameSite::Strict)},
10 {"COOKIE_SAMESITE_LAX", int(Response::Cookie::SameSite::Lax)},
11 {"COOKIE_SAMESITE_NONE", int(Response::Cookie::SameSite::None)},
12 });
13 0 ▶ xs::exp::autoexport(s);
Branch: 2 branches
BranchTrueFalseTotal
xs::exp::autoexport(s); 0 0 0
xs::exp::autoexport(s); 0 0 0
14 0 }
15
16 ResponseSP Response::new (Hash params = Hash()) {
17 0 RETVAL = make_backref<Response>();
18 0 ▶ if (params) fill(RETVAL, params);
Branch: 1 branch
BranchTrueFalseTotal
if (params) fill(RETVAL, params); 0 0 0
19 0 ▶}
Branch: 1 branch
BranchTrueFalseTotal
} 0 0 0
20 0 ▶
Branch: 2 branches
BranchTrueFalseTotal
0 0 0
0 0 0
21 int Response::code (SV* newval = NULL) {
22 0 ▶ if (newval) {
Branch: 1 branch
BranchTrueFalseTotal
if (newval) { 0 0 0
23 0 THIS->code = SvIV(newval);
24 0 XSRETURN_UNDEF;
25 }
26 0 ▶ RETVAL = THIS->code;
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = THIS->code; 0 0 0
27 }
28
29 string Response::message (SV* newval = NULL) {
30 0 ▶ if (newval) {
Branch: 1 branch
BranchTrueFalseTotal
if (newval) { 0 0 0
31 0 ▶ THIS->message = xs::in<string>(newval);
Branch: 2 branches
BranchTrueFalseTotal
THIS->message = xs::in<string>(newval); 0 0 0
THIS->message = xs::in<string>(newval); 0 0 0
32 0 XSRETURN_UNDEF;
33 }
34 0 ▶ RETVAL = THIS->message;
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = THIS->message; 0 0 0
35 }
36
37 0 ▶string Response::to_string (Request* req = nullptr)
Branch: 2 branches
BranchTrueFalseTotal
string Response::to_string (Request* req = nullptr) 0 0 0
string Response::to_string (Request* req = nullptr) 0 0 0
38  
39 string Response::message_for_code (int code = 0) {
40 0 ▶ RETVAL = THIS->message_for_code(code ? code : THIS->code);
Branch: 3 branches
BranchTrueFalseTotal
RETVAL = THIS->message_for_code(code ? code : THIS->code); 0 0 0
RETVAL = THIS->message_for_code(code ? code : THIS->code); 0 0 0
RETVAL = THIS->message_for_code(code ? code : THIS->code); 0 0 0
41 }
42  
43 Hash Response::cookies (Hash new_cookies = Hash()) {
44 0 ▶ if (new_cookies) {
Branch: 1 branch
BranchTrueFalseTotal
if (new_cookies) { 0 0 0
45 0 ▶ set_response_cookies(THIS, new_cookies);
Branch: 1 branch
BranchTrueFalseTotal
set_response_cookies(THIS, new_cookies); 0 0 0
46 0 XSRETURN_UNDEF;
47 }
48
49 0 ▶ RETVAL = Hash::create(THIS->cookies.size());
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = Hash::create(THIS->cookies.size()); 0 0 0
50 0 ▶ for (const auto& elem : THIS->cookies.fields) RETVAL.store(elem.name, xs::out(elem.value));
Branch: 3 branches
BranchTrueFalseTotal
for (const auto& elem : THIS->cookies.fields) RETVAL.store(elem.name, xs::out(elem.value)); 0 0 0
for (const auto& elem : THIS->cookies.fields) RETVAL.store(elem.name, xs::out(elem.value)); 0 0 0
for (const auto& elem : THIS->cookies.fields) RETVAL.store(elem.name, xs::out(elem.value)); 0 0 0
51 }
52
53 Response::Cookie Response::cookie (string_view name, SV* val = nullptr) {
54 0 if (val) {
55 0 ▶ if (!SvOK(val)) THIS->cookies.remove(name);
Branch: 1 branch
BranchTrueFalseTotal
if (!SvOK(val)) THIS->cookies.remove(name); 0 0 0
56 0 ▶ else THIS->cookies.set(string(name), xs::in<Response::Cookie>(val));
Branch: 2 branches
BranchTrueFalseTotal
else THIS->cookies.set(string(name), xs::in<Response::Cookie>(val)); 0 0 0
else THIS->cookies.set(string(name), xs::in<Response::Cookie>(val)); 0 0 0
57 0 ▶ XSRETURN_UNDEF;
Branch: 3 branches
BranchTrueFalseTotal
XSRETURN_UNDEF; 0 0 0
XSRETURN_UNDEF; 0 0 0
XSRETURN_UNDEF; 0 0 0
58 0 }
59
60 auto it = THIS->cookies.find(name);
61 0 ▶ if (it == THIS->cookies.end()) XSRETURN_UNDEF;
Branch: 1 branch
BranchTrueFalseTotal
if (it == THIS->cookies.end()) XSRETURN_UNDEF; 0 0 0
62 0 ▶ RETVAL = it->value;
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = it->value; 0 0 0
63 0 ▶}
Branch: 1 branch
BranchTrueFalseTotal
} 0 0 0
64
« xs/RequestParser.xsi ↑ Summary xs/ResponseParser.xsi »