Skip to content

Using a template with single quote fails #14

Closed
@baywet

Description

The follow code

uriTemplate, err := template.New("{+baseurl}/reports/getActiveUserDetail(period='{period}')")

fails with the error

errors.errorString{s:"uritemplate:72:invalid literals"}

according to

If the literal character is allowed anywhere in the URI syntax (unreserved / reserved / pct-encoded ), then it is copied directly to the result string.

https://datatracker.ietf.org/doc/html/rfc6570#section-3.1

single quote being a reserved literal in the URI spec, it should be copied as is (and therefore accepted).

After testing the sample template with a dotnet equivalent library and a java equivalent library parses the template properly.

Removing the quotes from the template also results in a successful parsing.

I believe an entry should be added here, but before I submitted any pull request I wanted to get a confirmation on the analysis.

{Lo: 0x0026, Hi: 0x0026, Stride: 1}, // '&'

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions