| 12631 | } |
| 12632 | |
| 12633 | [[nodiscard]] std::string url::get_host() const noexcept { |
| 12634 | // If url's host is null, then return the empty string. |
| 12635 | // If url's port is null, return url's host, serialized. |
| 12636 | // Return url's host, serialized, followed by U+003A (:) and url's port, |
| 12637 | // serialized. |
| 12638 | if (!host.has_value()) { |
| 12639 | return ""; |
| 12640 | } |
| 12641 | if (port.has_value()) { |
| 12642 | return host.value() + ":" + get_port(); |
| 12643 | } |
| 12644 | return host.value(); |
| 12645 | } |
| 12646 | |
| 12647 | [[nodiscard]] std::string url::get_hostname() const noexcept { |
| 12648 | return host.value_or(""); |
no test coverage detected