Function url_encoded_data::extract_url_encoded_string[][src]

pub fn extract_url_encoded_string(s: &str) -> &str

Algorithm

  1. If param: str contains ‘?’, then url_encoded_string = <there_after>.trim_start(‘?’)
  2. Else, url_encoded_string = param: str

Example

use url_encoded_data::*;
use url_encoded_data::extract_url_encoded_string;
let s = "a=1&b=2&c=3&c=4&key_without_value&=value_without_key";
assert_eq!(extract_url_encoded_string(s), s);

let s_prefixed_with_question_mark = "a=1&b=2&c=3&c=4&key_without_value&=value_without_key";
assert_eq!(extract_url_encoded_string(s_prefixed_with_question_mark), s);

let url = "http://abc.com/?".to_string() + s;
assert_eq!(extract_url_encoded_string(&url), s);

let url = "http://abc.com/?".to_string() + s;
assert_eq!(extract_url_encoded_string(&url), s);