MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / ToString

Method ToString

cpp/iedriver/BrowserCookie.cpp:61–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59}
60
61std::string BrowserCookie::ToString() const {
62 std::string cookie_string(this->name_ +
63 "=" +
64 this->value_ +
65 "; ");
66
67 if (this->is_secure_) {
68 cookie_string += "secure; ";
69 }
70
71 if (this->expiration_time_ > 0) {
72 time_t expiration_time = static_cast<time_t>(this->expiration_time_);
73 time_t current_time;
74 time(&current_time);
75 long long expiration_seconds = expiration_time - current_time;
76 cookie_string += "max-age=" + std::to_string(expiration_seconds) + ";";
77 }
78
79 if (this->domain_.size() > 0) {
80 cookie_string += "domain=" + this->domain_ + "; ";
81 }
82 if (this->path_.size() > 0) {
83 cookie_string += "path=" + this->path_ + "; ";
84 }
85 return cookie_string;
86}
87
88Json::Value BrowserCookie::ToJson() {
89 Json::Value cookie;

Callers 1

SetCookieMethod · 0.45

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected