Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Add custom prefix devurl #74

Merged
merged 7 commits into from
Aug 4, 2020
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Reverted err response
  • Loading branch information
Russtopia committed Jul 30, 2020
commit 11f797a7f7a5124aaae913b07236f3775e44a5da
18 changes: 10 additions & 8 deletions internal/entclient/devurl.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package entclient
import (
"fmt"
"net/http"

"golang.org/x/xerrors"
)

type delDevURLRequest struct {
Expand Down Expand Up @@ -50,12 +48,14 @@ func (c Client) InsertDevURL(envID string, port int, name, access string) error
Access: access,
Name: name,
})
if res != nil && res.StatusCode == http.StatusConflict {
return xerrors.Errorf("Failed to create devurl. Check that the port and name are unique.")
}
if err != nil {
return err
}

if res.StatusCode != http.StatusOK {
return bodyError(res)
}

return nil
}

Expand All @@ -77,11 +77,13 @@ func (c Client) UpdateDevURL(envID, urlID string, port int, name, access string)
Access: access,
Name: name,
})
if res != nil && res.StatusCode == http.StatusConflict {
return xerrors.Errorf("Failed to update devurl. Check that the port and name are unique.")
}
if err != nil {
return err
}

if res.StatusCode != http.StatusOK {
return bodyError(res)
}

return nil
}