I am delving into rom-rb with particular interest in rom-http for interacting with a web service.
I noticed that the default behavior of the JSON request handler clobbers the path of the dataset URI with dataset.absolute_path:
def self.call(dataset)
uri = URI(dataset.uri)
uri.path = dataset.absolute_path
[...]
end
The default implementation of absolute path prepends dataset.base_path with a slash. The effect of the behavior is that the path of the gateway URI is ignored.
My question is whether this behavior is intentional. Of course one can explicitly set base_path to the full path, but that seems odd. The base HTTP endpoint of a service is often not the root path of the site, so wouldn’t it make sense to configure this in the gateway and let the “base_path” of the dataset be relative to the gateway URI path?
For the moment I am overriding the request handler to behave the way I expect, but I wonder how other folks are using the library. It seems very well designed, but this one point is puzzling me.
Now, if I create a container and initialize a repository, the URI of the underlying dataset has the correct URI (appending the base_path “select” to the gateway URI path):
irb(main):011:0> puts uri
http://localhost:8983/select
What I think should happen is that the path of the dataset URI should not be “fixed” – i.e. that it’s the responsibility of the gateway to set the base URI (as it does for the value of dataset.uri).