diff --git a/README.md b/README.md index 245a61f7..f6ad10a9 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,7 @@ This library is compatible with Go 1.2+ hostConfig := ibclient.HostConfig{ Scheme: "https", Host: "", + BasePath: "", Version: "", Port: "PORT", } diff --git a/connector.go b/connector.go index 110d116f..b2bfeb8a 100644 --- a/connector.go +++ b/connector.go @@ -28,10 +28,11 @@ type AuthConfig struct { } type HostConfig struct { - Scheme string - Host string - Version string - Port string + Scheme string + Host string + BasePath string + Version string + Port string } type TransportConfig struct { @@ -244,7 +245,12 @@ func (wrb *WapiRequestBuilder) Init(hostCfg HostConfig, authCfg AuthConfig) { } func (wrb *WapiRequestBuilder) BuildUrl(t RequestType, objType string, ref string, returnFields []string, queryParams *QueryParams) (urlStr string) { - path := []string{"wapi", "v" + wrb.hostCfg.Version} + if wrb.hostCfg.BasePath != "" { + path := []string{wrb.hostCfg.BasePath,"wapi", "v" + wrb.hostCfg.Version} + } else { + path := []string{"wapi", "v" + wrb.hostCfg.Version} + } + if len(ref) > 0 { path = append(path, ref) } else {