Skip to main content

build_query_string

Function build_query_string 

Source
pub fn build_query_string(params: &HashMap<&str, &str>) -> String
Expand description

Build a URL query string using standard percent-encoding (%20 for spaces).

OAuth authorize endpoints and similar browser-facing URLs require %20 for spaces instead of + (which is only valid in application/x-www-form-urlencoded POST bodies). This function matches the encoding used by the official OpenAI Codex CLI (urlencoding::encode).

Keys are emitted in the order returned by the HashMap iterator. Use build_query_string_ordered when deterministic ordering is required.