parse_header

Function parse_header 

Source
pub fn parse_header(s: &str) -> Result<(String, String), String>
Expand description

Parses a header string in “key:value” format for CLI arguments.

Used internally by clap to validate and parse header arguments. Headers must be provided as key:value pairs with no spaces around the colon.

§Examples

let result = graphql_codegen_rust::cli::parse_header("Authorization:Bearer token123");
assert_eq!(result.unwrap(), ("Authorization".to_string(), "Bearer token123".to_string()));

§Errors

Returns an error if the string doesn’t contain exactly one colon separator, or if the key or value would be empty after trimming.