expandTemplateURIVariable

Expands a variable template part of a URI template as defined in RFC 6570.

Parameters

templateString string

The template variable definition without surrounding braces.

strict bool

Validate entire string strictly according to RFC 6570. Does NOT perform unicode code-point validation. Performs character-by-character checks for exact grammar checks.

index size_t

Byte index to offset malformed URI format exceptions.

Return Value

Type: string

the resolved variable value (properly URI encoded)

Throws

TemplateURIFormatException on attempted use of a reserved operator, invalid variable specifications or strict issues.

Examples

assert(expandTemplateURIVariable(`?since,all,participating`,
		delegate(string k) @safe => URIVariable.init) == "");

assert(expandTemplateURIVariable(`?since,all,participating`, null) == "");

assert(expandTemplateURIVariable(`?since,all,participating`, ["all": "1"]) == "?all=1");

assert(expandTemplateURIVariable(`?since,all,participating`, [
			"all": URIVariable("1"),
			"participating": URIVariable("1")
		]) == "?all=1&participating=1");

Meta