mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
rpc: fix tests
This commit is contained in:
parent
8fe5ace9e8
commit
ce8883c68c
2 changed files with 4 additions and 4 deletions
|
|
@ -66,7 +66,7 @@ func TestHTTPErrorResponseWithPut(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestHTTPErrorResponseWithMaxContentLength(t *testing.T) {
|
func TestHTTPErrorResponseWithMaxContentLength(t *testing.T) {
|
||||||
body := make([]rune, maxRequestContentLength+1)
|
body := make([]rune, defaultBodyLimit+1)
|
||||||
confirmRequestValidationCode(t,
|
confirmRequestValidationCode(t,
|
||||||
http.MethodPost, contentType, string(body), http.StatusRequestEntityTooLarge)
|
http.MethodPost, contentType, string(body), http.StatusRequestEntityTooLarge)
|
||||||
}
|
}
|
||||||
|
|
@ -106,7 +106,7 @@ func TestHTTPResponseWithEmptyGet(t *testing.T) {
|
||||||
|
|
||||||
// This checks that maxRequestContentLength is not applied to the response of a request.
|
// This checks that maxRequestContentLength is not applied to the response of a request.
|
||||||
func TestHTTPRespBodyUnlimited(t *testing.T) {
|
func TestHTTPRespBodyUnlimited(t *testing.T) {
|
||||||
const respLength = maxRequestContentLength * 3
|
const respLength = defaultBodyLimit * 3
|
||||||
|
|
||||||
s := NewServer()
|
s := NewServer()
|
||||||
defer s.Stop()
|
defer s.Stop()
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ func TestWebsocketLargeCall(t *testing.T) {
|
||||||
|
|
||||||
// This call sends slightly less than the limit and should work.
|
// This call sends slightly less than the limit and should work.
|
||||||
var result echoResult
|
var result echoResult
|
||||||
arg := strings.Repeat("x", maxRequestContentLength-200)
|
arg := strings.Repeat("x", defaultBodyLimit-200)
|
||||||
if err := client.Call(&result, "test_echo", arg, 1); err != nil {
|
if err := client.Call(&result, "test_echo", arg, 1); err != nil {
|
||||||
t.Fatalf("valid call didn't work: %v", err)
|
t.Fatalf("valid call didn't work: %v", err)
|
||||||
}
|
}
|
||||||
|
|
@ -106,7 +106,7 @@ func TestWebsocketLargeCall(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// This call sends twice the allowed size and shouldn't work.
|
// This call sends twice the allowed size and shouldn't work.
|
||||||
arg = strings.Repeat("x", maxRequestContentLength*2)
|
arg = strings.Repeat("x", defaultBodyLimit*2)
|
||||||
err = client.Call(&result, "test_echo", arg)
|
err = client.Call(&result, "test_echo", arg)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Fatal("no error for too large call")
|
t.Fatal("no error for too large call")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue