Skip to content
This repository was archived by the owner on Jun 28, 2023. It is now read-only.
Open
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions api/internal/bus/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ type Client struct {
HTTPClient *http.Client
}

func (c *Client) GetSessionURL() string {
return c.SessionURL
}

func (c *Client) Send(method, endpoint string, body interface{}, result interface{}) error {
requestBody, err := bodyToJSON(body)
if err != nil {
Expand Down
4 changes: 4 additions & 0 deletions api/internal/mocks/bus.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ func (b *Bus) Send(method, endpoint string, body, result interface{}) error {
}
return b.SendCall.Err
}

func (b *Bus) GetSessionURL() string {
return "mock"
}
5 changes: 5 additions & 0 deletions api/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ type Session struct {

type Bus interface {
Send(method, endpoint string, body, result interface{}) error
GetSessionURL() string
}

func New(sessionURL string) *Session {
Expand All @@ -41,6 +42,10 @@ func OpenWithClient(url string, capabilities map[string]interface{}, client *htt
return &Session{busClient}, nil
}

func (s *Session) URL() string {
return s.Bus.GetSessionURL()
}

func (s *Session) Delete() error {
return s.Send("DELETE", "", nil, nil)
}
Expand Down
4 changes: 4 additions & 0 deletions internal/mocks/bus.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ func (b *Bus) Send(method, endpoint string, body, result interface{}) error {
}
return b.SendCall.Err
}

func (b *Bus) GetSessionURL() string {
return "mock"
}