mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
+1
-1
@@ -24,7 +24,7 @@ import "core:encoding/hex"
|
|||||||
split_url :: proc(url: string, allocator := context.allocator) -> (scheme, host, path: string, queries: map[string]string) {
|
split_url :: proc(url: string, allocator := context.allocator) -> (scheme, host, path: string, queries: map[string]string) {
|
||||||
s := url
|
s := url
|
||||||
|
|
||||||
i := strings.last_index(s, "://")
|
i := strings.index(s, "://")
|
||||||
if i >= 0 {
|
if i >= 0 {
|
||||||
scheme = s[:i]
|
scheme = s[:i]
|
||||||
s = s[i+3:]
|
s = s[i+3:]
|
||||||
|
|||||||
@@ -572,6 +572,11 @@ split_url_test :: proc(t: ^testing.T) {
|
|||||||
{"a" = "", "b" = ""},
|
{"a" = "", "b" = ""},
|
||||||
{"http://example.com/example?a&b"},
|
{"http://example.com/example?a&b"},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"https", "example.com", "/callback",
|
||||||
|
{"redirect" = "https://other.com/login"},
|
||||||
|
{"https://example.com/callback?redirect=https://other.com/login"},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for test in test_cases {
|
for test in test_cases {
|
||||||
|
|||||||
Reference in New Issue
Block a user