URI URL parser for Godot
Go to file
Leon van Kammen ba9b7ee3bc main: update documentation 2024-05-17 17:30:26 +02:00
README.md main: update documentation 2024-05-17 17:30:26 +02:00
URI.gd main: work in progress [might break] 2024-05-17 17:28:19 +02:00

README.md

URI parser for Godot

You want a javascript-ish document.location kind of dictionary for URLs? We've got your back!

Why?
Participants of the Open Web think & communicate in URI's: now with Godot (>=4) too!

This class will not win the beauty contest related to RFC 3986, but here goes:

USAGE

xrf = preload("res://URI.gd").new()
print( URI.parse("https://foo.com/a/bc.gltf?bar=2#foo=2") )
print( URI.parse("a/bc.gltf?a=1#foo=2") )

OUTPUT:

   { "domain": "foo.com", "fragment": { "foo": { "string": "2", "x": <null>, "y": <null>, "color": <null>, "float": <null>, "int": <null> } }, "file": "bc.gltf", "URN": "https://foo.com/a/bc.gltf?bar=2#foo=2", "string": "https://foo.com/a/bc.gltf?bar=2#foo=2", "protocol": "https", "path": "a/bc.gltf", "query": { "bar": { "string": "2", "x": <null>, "y": <null>, "color": <null>, "float": <null>, "int": <null> } }, "hash": "#foo=2", "isLocal": false }
   { "domain": "", "fragment": { "foo": { "string": "2", "x": <null>, "y": <null>, "color": <null>, "float": <null>, "int": <null> } }, "file": "bc.gltf", "URN": "", "string": "a/bc.gltf?a=1#foo=2", "protocol": "", "path": "a/bc.gltf", "query": { "a": { "string": "1", "x": <null>, "y": <null>, "color": <null>, "float": <null>, "int": <null> } }, "hash": "#foo=2", "isLocal": true }