diff options
| author | Yoshihiro Tanaka <contact@cordea.jp> | 2023-05-14 11:10:53 +0900 |
|---|---|---|
| committer | Yoshihiro Tanaka <contact@cordea.jp> | 2023-05-14 12:15:20 +0900 |
| commit | 418a0132d033c7556cbd3db665affd6059daa6bf (patch) | |
| tree | a282d4a5e266a2577b10c03d47c7794c68b3b8d2 /core/net | |
| parent | 8693a045bbba40c5614ff5912137540c91e61cb0 (diff) | |
Join URL queries with &
Diffstat (limited to 'core/net')
| -rw-r--r-- | core/net/url.odin | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/core/net/url.odin b/core/net/url.odin index 460bb70ad..b529ca082 100644 --- a/core/net/url.odin +++ b/core/net/url.odin @@ -78,13 +78,19 @@ join_url :: proc(scheme, host, path: string, queries: map[string]string, allocat } - if len(queries) > 0 do write_string(&b, "?") + query_length := len(queries) + if query_length > 0 do write_string(&b, "?") + i := 0 for query_name, query_value in queries { write_string(&b, query_name) if query_value != "" { write_string(&b, "=") write_string(&b, query_value) } + if i < query_length - 1 { + write_string(&b, "&") + } + i += 1 } return to_string(b) |