瀏覽代碼

http2: fix typo and simplify truncation of text in test

Change-Id: Icb13d896a79e44fbddba0a4776be2da7918edd33
Reviewed-on: https://go-review.googlesource.com/18109
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Brad Fitzpatrick 10 年之前
父節點
當前提交
5d0a0f8cd4
共有 2 個文件被更改,包括 2 次插入6 次删除
  1. 1 1
      http2/frame.go
  2. 1 5
      http2/server_test.go

+ 1 - 1
http2/frame.go

@@ -374,7 +374,7 @@ func terminalReadFrameError(err error) bool {
 // until the next call to ReadFrame.
 //
 // If the frame is larger than previously set with SetMaxReadFrameSize, the
-// returned error is ErrFrameTooLarge. Other errors may of type
+// returned error is ErrFrameTooLarge. Other errors may be of type
 // ConnectionError, StreamError, or anything else from from the underlying
 // reader.
 func (fr *Framer) ReadFrame() (Frame, error) {

+ 1 - 5
http2/server_test.go

@@ -944,11 +944,7 @@ func TestServer_RejectsLargeFrames(t *testing.T) {
 	if st.logBuf.Len() != 0 {
 		// Previously we spun here for a bit until the GOAWAY disconnect
 		// timer fired, logging while we fired.
-		trunc := st.logBuf.Len()
-		if trunc > 500 {
-			trunc = 500
-		}
-		t.Errorf("unexpected server output: %s\n", st.logBuf.Bytes()[:trunc])
+		t.Errorf("unexpected server output: %.500s\n", st.logBuf.Bytes())
 	}
 }