MCPcopy Create free account
hub / github.com/ada-url/ada / process_search

Method process_search

src/url_pattern.cpp:337–355  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

335}
336
337tl::expected<std::string, errors> url_pattern_init::process_search(
338 std::string_view value, process_type type) {
339 // Let strippedValue be the given value with a single leading U+003F (?)
340 // removed, if any.
341 if (value.starts_with("?")) {
342 value.remove_prefix(1);
343 }
344 // We cannot assert that the value is no longer starting with a single
345 // question mark because technically it can start. The question is whether or
346 // not we should remove the first question mark. Ref:
347 // https://github.com/ada-url/ada/pull/992 The spec is not clear on this.
348
349 // If type is "pattern" then return strippedValue.
350 if (type == process_type::pattern) {
351 return std::string(value);
352 }
353 // Return the result of running canonicalize a search given strippedValue.
354 return url_pattern_helpers::canonicalize_search(value);
355}
356
357tl::expected<std::string, errors> url_pattern_init::process_hash(
358 std::string_view value, process_type type) {

Callers

nothing calls this directly

Calls 1

canonicalize_searchFunction · 0.85

Tested by

no test coverage detected