Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

Use passed URL as schemasURL when is has /schemas suffix #121

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions catalog/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"net/url"
"os"
"regexp"
"strings"
"time"

"github.com/gorilla/websocket"
Expand Down Expand Up @@ -151,9 +152,14 @@ func setupRancherBaseClient(rancherClient *RancherBaseClientImpl, opts *ClientOp
return newApiError(resp, opts.Url)
}

schemasUrls := resp.Header.Get("X-API-Schemas")
if len(schemasUrls) == 0 {
return errors.New("Failed to find schema at [" + opts.Url + "]")
var schemasUrls string
if strings.HasSuffix(opts.Url, "/schemas") {
schemasUrls = opts.Url
} else {
schemasUrls = resp.Header.Get("X-API-Schemas")
if len(schemasUrls) == 0 {
return errors.New("Failed to find schema at [" + opts.Url + "]")
}
}

if schemasUrls != opts.Url {
Expand Down