[web] Use 'Uri' instead of 'dart:html' to extract pathname (#127983)

- Use `Uri.parse()` to extract pathname.
- Remove unused code from `utils.dart`.
- Add test for URL encoding.

(need to wait for https://github.com/flutter/flutter/pull/126851 to make it into Google3)
This commit is contained in:
Mouad Debbar
2023-06-05 23:46:02 -04:00
committed by GitHub
parent 9753223932
commit d87656559c
3 changed files with 6 additions and 17 deletions

View File

@@ -33,5 +33,9 @@ void main() {
expect(extractPathname('https://example.com/foo'), '/foo');
expect(extractPathname('https://example.com/foo#bar'), '/foo');
expect(extractPathname('https://example.com/foo/#bar'), '/foo/');
// URL encoding.
expect(extractPathname('/foo bar'), '/foo%20bar');
expect(extractPathname('https://example.com/foo bar'), '/foo%20bar');
});
}