worker: prefix all routes with /api/worker/v1

Mention this in the `servers` section of the openapi.yml (relative URLs
are allowed) too, even though our generator does not consider it.
This commit is contained in:
Lars Karlitski 2020-09-23 15:57:55 +02:00 committed by Tom Gundersen
parent 9008a1defc
commit a8ba969f6e
6 changed files with 35 additions and 21 deletions

View file

@ -48,6 +48,11 @@ func NewClient(baseURL string, conf *tls.Config) (*Client, error) {
return nil, err
}
server, err = server.Parse(api.BasePath + "/")
if err != nil {
panic(err)
}
requester := &http.Client{
Transport: &http.Transport{
TLSClientConfig: conf,
@ -58,7 +63,12 @@ func NewClient(baseURL string, conf *tls.Config) (*Client, error) {
}
func NewClientUnix(path string) *Client {
server, err := url.Parse("http://localhost")
server, err := url.Parse("http://localhost/")
if err != nil {
panic(err)
}
server, err = server.Parse(api.BasePath + "/")
if err != nil {
panic(err)
}
@ -75,9 +85,9 @@ func NewClientUnix(path string) *Client {
}
func (c *Client) RequestJob() (Job, error) {
url, err := c.server.Parse("/jobs")
url, err := c.server.Parse("jobs")
if err != nil {
// This only happens when "/jobs" cannot be parsed.
// This only happens when "jobs" cannot be parsed.
panic(err)
}