robotframework-httplibrary icon indicating copy to clipboard operation
robotframework-httplibrary copied to clipboard

Add keyword to help construct a URL with query parameters

Open ombre42 opened this issue 11 years ago • 3 comments

When using query parameters, various characters need to be 'percent-encoded'. This can be done manually when the parameters are known, but when constructing the URL from unknown inputs, a method must be used to do the encoding. urllib.urlencode provides encoding functionality.

ombre42 avatar Jul 02 '13 15:07 ombre42

Yes, you're right. Care to submit a pull request ? Perhaps something similar to the JSON keywords (i. e. creating/parsing query-string <-> robot framework dictionaries) ?

peritus avatar Jul 02 '13 15:07 peritus

I will submit a pull request, but I want to get a new release of SudsLibrary done first. How does this look: build_url(path, *key_value_pairs) where key_value_pairs can also be a dict. This makes the keyword easier to use for simple use cases.

${url}=    Build Url    /foo    type    checking account
# or
${param dict}=    Create Dictionary    type    checking account
${url}=    Build Url    /foo    ${param dict}

${url} would have value u'/foo?type=checking%20account' URL here is not really a URL, but the part of the URL that you referred to as URL in other keywords such as POST.

ombre42 avatar Jul 02 '13 16:07 ombre42

can i pass ?(@.ABC || @.XYZ) in the http get request. I tired it on my machine it's failing.

ShanthkumarS079 avatar Jun 07 '16 08:06 ShanthkumarS079