Skip to content
Merged
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
11 changes: 11 additions & 0 deletions pkg/api/internalclient/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import (
"context"
"errors"
"fmt"
"net/http"

"github.com/gorilla/websocket"
"github.com/shellhub-io/shellhub/pkg/api/requests"
"github.com/shellhub-io/shellhub/pkg/models"
"github.com/sirupsen/logrus"
)

// sessionAPI defines methods for interacting with session-related functionality.
Expand Down Expand Up @@ -140,6 +142,15 @@ func (c *client) SaveSession(uid string, seat int) error {
switch {
case res.StatusCode() == 404:
return ErrNotFound
case res.StatusCode() == http.StatusNotAcceptable:
// NOTE: [http.StatusNotAcceptable] indicates that session's seat shouldn't be save, but also shouldn't
// represent an error.
logrus.WithFields(logrus.Fields{
"uid": uid,
"seat": fmt.Sprintf("%d", seat),
}).Debug("save session not acceptable")

return nil
case res.StatusCode() != 200:
return errors.New("failed to save the Asciinema due status code")
}
Expand Down
Loading