hyTags
HomeHome DocumentationDocumentation

url-add-query-param

Adds a query parameter to a URL and returns a new URL
Parameter
Type
Description
self
Url
The URL to modify
name
String
The name of the query parameter
value
String?
The value of the query parameter
return
url
A new URL with the query parameter added
Test Case:Add query param to URL
    <div></div>
    
    <url-from-string string="https://example.com/path">
    <url-add-query-param name="key" value="value">
    <url-to-string>
    <assert-equal value="https://example.com/path?key=value" type="string">
    
    👆 Try to change something!
  • Test Case:Add query param to URL with existing params
      <div></div>
      
      <url-from-string string="https://example.com/path?existing=1">
      <url-add-query-param name="new" value="2">
      <url-to-string>
      <assert-equal value="https://example.com/path?existing=1&amp;new=2" type="string">
      
      👆 Try to change something!
    • Test succeeded Test failed