File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -110,7 +110,7 @@ func TestIsJson(t *testing.T) {
110110 {
111111 name : "No content-type headers with request payload longer than max length" ,
112112 reqContentType : "" ,
113- reqBody : strings .Repeat ("a" , 1025 ),
113+ reqBody : `{"key": "` + strings .Repeat ("a" , 1025 ) + `"}` ,
114114 respContentType : "" ,
115115 respBody : `` ,
116116 maxContentLength : 1024 ,
@@ -121,7 +121,7 @@ func TestIsJson(t *testing.T) {
121121 reqContentType : "" ,
122122 reqBody : `` ,
123123 respContentType : "" ,
124- respBody : strings .Repeat ("a" , 1025 ),
124+ respBody : `{"key": "` + strings .Repeat ("a" , 1025 ) + `"}` ,
125125 maxContentLength : 1024 ,
126126 expectedResult : false ,
127127 },
@@ -156,8 +156,9 @@ func TestIsJson(t *testing.T) {
156156 }
157157
158158 resp := & http.Response {
159- Header : make (http.Header ),
160- Body : io .NopCloser (strings .NewReader (tt .respBody )),
159+ Header : make (http.Header ),
160+ Body : io .NopCloser (strings .NewReader (tt .respBody )),
161+ ContentLength : int64 (len (tt .respBody )),
161162 }
162163 if tt .respContentType != "" {
163164 resp .Header .Set ("Content-Type" , tt .respContentType )
You can’t perform that action at this time.
0 commit comments