| 16095 | } |
| 16096 | |
| 16097 | tl::expected<std::string, errors> canonicalize_username( |
| 16098 | std::string_view input) { |
| 16099 | // If value is the empty string, return value. |
| 16100 | if (input.empty()) [[unlikely]] { |
| 16101 | return ""; |
| 16102 | } |
| 16103 | // Let dummyURL be a new URL record. |
| 16104 | auto url = ada::parse<url_aggregator>("fake://dummy.test", nullptr); |
| 16105 | ADA_ASSERT_TRUE(url.has_value()); |
| 16106 | // Set the username given dummyURL and value. |
| 16107 | if (!url->set_username(input)) { |
| 16108 | return tl::unexpected(errors::type_error); |
| 16109 | } |
| 16110 | // Return dummyURL's username. |
| 16111 | return std::string(url->get_username()); |
| 16112 | } |
| 16113 | |
| 16114 | tl::expected<std::string, errors> canonicalize_password( |
| 16115 | std::string_view input) { |
no test coverage detected