Add projects
This commit is contained in:
parent
2d3a9ad623
commit
8b607dd700
1802 changed files with 503346 additions and 2 deletions
25
backend/sdk/cliproxy/executor/websocket_test.go
Normal file
25
backend/sdk/cliproxy/executor/websocket_test.go
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
package executor
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestUpstreamWebsocketReplayRequiredError(t *testing.T) {
|
||||
err := NewUpstreamWebsocketReplayRequiredError()
|
||||
if !IsUpstreamWebsocketReplayRequired(err) {
|
||||
t.Fatal("replay error was not recognized")
|
||||
}
|
||||
if !IsUpstreamWebsocketReplayRequired(fmt.Errorf("wrapped: %w", err)) {
|
||||
t.Fatal("wrapped replay error was not recognized")
|
||||
}
|
||||
statusErr, ok := err.(interface{ StatusCode() int })
|
||||
if !ok || statusErr.StatusCode() != http.StatusUpgradeRequired {
|
||||
t.Fatalf("replay error = %T %v, want status 426", err, err)
|
||||
}
|
||||
requestErr, ok := err.(RequestScopedError)
|
||||
if !ok || !requestErr.IsRequestScoped() {
|
||||
t.Fatalf("replay error = %T, want request scoped", err)
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue