wrest icon indicating copy to clipboard operation
wrest copied to clipboard

Inconsistent behaviour while creating a template from a URI

Open achamian opened this issue 14 years ago • 0 comments

Executing following code

base = 'http://foo.com/api/xml'.to_uri p base.to_template("bar/:id").uri_pattern

base = 'http://foo.com/api/xml/'.to_uri p base.to_template("bar/:id").uri_pattern

base = 'http://foo.com/api/xml'.to_uri p base.to_template("/bar/:id").uri_pattern

Produces

"http://foo.com/api/bar/:id"

"http://foo.com/api/xml/bar/:id" # Expected behaviour (Considering p base["/bar"].uri_string to be standard)

"http://foo.com/bar/:id"

Note that 'xml' is dropped in first case where as only base path is considered in last.

achamian avatar Mar 12 '11 19:03 achamian