@@ -31,8 +31,9 @@ func TestTestCase(t *testing.T) {
3131			},
3232			Expect : atest.Response {
3333				StatusCode : http .StatusOK ,
34- 				BodyFieldsExpect : map [string ]string {
35- 					"name" : "linuxsuren" ,
34+ 				BodyFieldsExpect : map [string ]interface {}{
35+ 					"name" :   "linuxsuren" ,
36+ 					"number" : 1 ,
3637				},
3738				Header : map [string ]string {
3839					"type" : "generic" ,
@@ -52,7 +53,7 @@ func TestTestCase(t *testing.T) {
5253		},
5354		verify : func (t  * testing.T , output  interface {}, err  error ) {
5455			assert .Nil (t , err )
55- 			assert .Equal (t , map [string ]interface {}{"name" : "linuxsuren" }, output )
56+ 			assert .Equal (t , map [string ]interface {}{"name" : "linuxsuren" ,  "number" :  float64 ( 1 ) }, output )
5657		},
5758	}, {
5859		name : "normal, response is slice" ,
@@ -181,7 +182,7 @@ func TestTestCase(t *testing.T) {
181182				API : "http://localhost/foo" ,
182183			},
183184			Expect : atest.Response {
184- 				BodyFieldsExpect : map [string ]string {
185+ 				BodyFieldsExpect : map [string ]interface {} {
185186					"foo" : "bar" ,
186187				},
187188			},
@@ -200,7 +201,7 @@ func TestTestCase(t *testing.T) {
200201				API : "http://localhost/foo" ,
201202			},
202203			Expect : atest.Response {
203- 				BodyFieldsExpect : map [string ]string {
204+ 				BodyFieldsExpect : map [string ]interface {} {
204205					"name" : "bar" ,
205206				},
206207			},
@@ -219,7 +220,7 @@ func TestTestCase(t *testing.T) {
219220				API : "http://localhost/foo" ,
220221			},
221222			Expect : atest.Response {
222- 				BodyFieldsExpect : map [string ]string {
223+ 				BodyFieldsExpect : map [string ]interface {} {
223224					"items[1]" : "bar" ,
224225				},
225226			},
@@ -316,7 +317,7 @@ func TestTestCase(t *testing.T) {
316317			assert .Contains (t , err .Error (), "template: api:1:" )
317318		},
318319	}, {
319- 		name : "form request" ,
320+ 		name : "multipart  form request" ,
320321		testCase : & atest.TestCase {
321322			Request : atest.Request {
322323				API :    "http://localhost/foo" ,
@@ -336,6 +337,27 @@ func TestTestCase(t *testing.T) {
336337		verify : func (t  * testing.T , output  interface {}, err  error ) {
337338			assert .Nil (t , err )
338339		},
340+ 	}, {
341+ 		name : "normal form request" ,
342+ 		testCase : & atest.TestCase {
343+ 			Request : atest.Request {
344+ 				API :    "http://localhost/foo" ,
345+ 				Method : http .MethodPost ,
346+ 				Header : map [string ]string {
347+ 					"Content-Type" : "application/x-www-form-urlencoded" ,
348+ 				},
349+ 				Form : map [string ]string {
350+ 					"key" : "value" ,
351+ 				},
352+ 			},
353+ 		},
354+ 		prepare : func () {
355+ 			gock .New ("http://localhost" ).
356+ 				Post ("/foo" ).Reply (http .StatusOK ).BodyString (`{"items":[]}` )
357+ 		},
358+ 		verify : func (t  * testing.T , output  interface {}, err  error ) {
359+ 			assert .Nil (t , err )
360+ 		},
339361	}}
340362	for  _ , tt  :=  range  tests  {
341363		t .Run (tt .name , func (t  * testing.T ) {
0 commit comments