hyTags
HomeHome DocumentationDocumentation

url-new

Creates a new URL from components
Parameter
Type
Description
schema
String?
The URL scheme (e.g., 'http', 'https')
host
String?
The host domain or IP address
port
Number?
The port number, or nil if not specified
path
String?
The path portion of the URL
query
String?
The query string portion of the URL
anchor
String?
The anchor (fragment) portion of the URL
return
url
The newly created URL
Test Case:Create URL from components
    <div></div>
    
    <url-new schema="https" host="example.com" port="8080" path="/api/v1" query="key=value" anchor="section">
    <url-to-string>
    <assert-equal value="https://example.com:8080/api/v1?key=value#section" type="string">
    
    👆 Try to change something!
  • Test Case:Create URL without optional components
      <div></div>
      
      <url-new schema="https" host="example.com">
      <url-to-string>
      <assert-equal value="https://example.com" type="string">
      
      👆 Try to change something!
    • Test succeeded Test failed