File tree Expand file tree Collapse file tree 1 file changed +0
-14
lines changed
Expand file tree Collapse file tree 1 file changed +0
-14
lines changed Original file line number Diff line number Diff line change 1- // Package util provides common utilities for the Olla application.
21package util
32
43import (
@@ -18,19 +17,6 @@ import (
1817// Examples:
1918// - ResolveURLPath("http://localhost:12434/api/", "/v1/models") -> "http://localhost:12434/api/v1/models"
2019// - ResolveURLPath("http://localhost:12434/api/", "http://other:9000/models") -> "http://other:9000/models"
21- //
22- // ResolveURLPath resolves a path or absolute URL against a base URL.
23- // This function exists because url.ResolveReference() follows RFC 3986 strictly,
24- // treating paths with leading "/" as absolute references that replace the entire base path.
25- // In our context, we want to preserve the base path prefix when joining with relative paths.
26- //
27- // We use url.Parse() and path.Join() to achieve the desired behaviour where:
28- // - Absolute URLs (with scheme) are returned unchanged
29- // - Relative paths are appended to the base URL's path, preserving the base path prefix
30- //
31- // Examples:
32- // - ResolveURLPath("http://localhost:12434/api/", "/v1/models") -> "http://localhost:12434/api/v1/models"
33- // - ResolveURLPath("http://localhost:12434/api/", "http://other:9000/models") -> "http://other:9000/models"
3420func ResolveURLPath (baseURL , pathOrURL string ) string {
3521 if baseURL == "" {
3622 return pathOrURL
You can’t perform that action at this time.
0 commit comments