damnhandy / Handy-URI-Templates

A Java URI Template processor implementing RFC6570

Home Page:https://damnhandy.github.io/Handy-URI-Templates/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

UriTemplateBuilder does not reject variables with invalid characters

cinder-fish opened this issue · comments

UriTemplate.buildFromTemplate("location")
  .query("invalid-variable")
  .build();

Returns a usable UriTemplate that will expand and expandPartial using this variable name as normal

However

UriTemplate.fromTemplate("location{?invalid-variable}");

Throws an exception as the variable name does not match https://tools.ietf.org/html/rfc6570#section-2.3

I think here that query should probably be throwing a similar exception.

Nice catch. That is definitely incorrect.

The fix is now in the 2.1.6-SNAPSHOT build, which should be available in Maven Central. I plan on releasing 2.1.6 once I figure out a solution to #51

2.1.6 has been released with this fix.