I'm not thrilled about this approach, but can't suggest anything better. Using `URI.join` from stdlib would be ideal, but it's behavior depends so much on having a full URI and constructing path parameters correctly (e.g. a leading "/" will overwrite the full path to that point, "directories" must have a trailing "/") that we end up duplicating much of this logic anyway.