damnhandy / Handy-URI-Templates

A Java URI Template processor implementing RFC6570
https://damnhandy.github.io/Handy-URI-Templates/
Other
203 stars 37 forks source link

UriTemplateBuilder does not reject variables with invalid characters #52

Closed cinder-fish closed 8 years ago

cinder-fish commented 8 years ago
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.

damnhandy commented 8 years ago

Nice catch. That is definitely incorrect.

damnhandy commented 8 years ago

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

damnhandy commented 8 years ago

2.1.6 has been released with this fix.