@@ -56,7 +56,7 @@ func Test_Router_Handler_Strict_WithObject(t *testing.T) {
56
56
client := g .Client ()
57
57
client .SetPrefix (fmt .Sprintf ("http://127.0.0.1:%d" , s .GetListenedPort ()))
58
58
59
- t .Assert (client .GetContent (ctx , "/test?age=18&name=john" ), `{"code":0,"message":"","data":{"Id":1,"Age":18,"Name":"john"}}` )
59
+ t .Assert (client .GetContent (ctx , "/test?age=18&name=john" ), `{"code":0,"message":"OK ","data":{"Id":1,"Age":18,"Name":"john"}}` )
60
60
t .Assert (client .GetContent (ctx , "/test/error" ), `{"code":50,"message":"error","data":{"Id":1,"Age":0,"Name":""}}` )
61
61
})
62
62
}
@@ -153,8 +153,8 @@ func Test_Router_Handler_Strict_WithObjectAndMeta(t *testing.T) {
153
153
client .SetPrefix (fmt .Sprintf ("http://127.0.0.1:%d" , s .GetListenedPort ()))
154
154
155
155
t .Assert (client .GetContent (ctx , "/" ), `{"code":65,"message":"Not Found","data":null}` )
156
- t .Assert (client .GetContent (ctx , "/custom-test1?age=18&name=john" ), `{"code":0,"message":"","data":{"Id":1,"Age":18}}` )
157
- t .Assert (client .GetContent (ctx , "/custom-test2?age=18&name=john" ), `{"code":0,"message":"","data":{"Id":1,"Name":"john"}}` )
156
+ t .Assert (client .GetContent (ctx , "/custom-test1?age=18&name=john" ), `{"code":0,"message":"OK ","data":{"Id":1,"Age":18}}` )
157
+ t .Assert (client .GetContent (ctx , "/custom-test2?age=18&name=john" ), `{"code":0,"message":"OK ","data":{"Id":1,"Name":"john"}}` )
158
158
t .Assert (client .PostContent (ctx , "/custom-test2?age=18&name=john" ), `{"code":65,"message":"Not Found","data":null}` )
159
159
})
160
160
}
@@ -184,17 +184,17 @@ func Test_Router_Handler_Strict_Group_Bind(t *testing.T) {
184
184
client .SetPrefix (fmt .Sprintf ("http://127.0.0.1:%d" , s .GetListenedPort ()))
185
185
186
186
t .Assert (client .GetContent (ctx , "/" ), `{"code":65,"message":"Not Found","data":null}` )
187
- t .Assert (client .GetContent (ctx , "/api/v1/custom-test1?age=18&name=john" ), `{"code":0,"message":"","data":{"Id":1,"Age":18}}` )
188
- t .Assert (client .GetContent (ctx , "/api/v1/custom-test2?age=18&name=john" ), `{"code":0,"message":"","data":{"Id":1,"Name":"john"}}` )
187
+ t .Assert (client .GetContent (ctx , "/api/v1/custom-test1?age=18&name=john" ), `{"code":0,"message":"OK ","data":{"Id":1,"Age":18}}` )
188
+ t .Assert (client .GetContent (ctx , "/api/v1/custom-test2?age=18&name=john" ), `{"code":0,"message":"OK ","data":{"Id":1,"Name":"john"}}` )
189
189
t .Assert (client .PostContent (ctx , "/api/v1/custom-test2?age=18&name=john" ), `{"code":65,"message":"Not Found","data":null}` )
190
190
191
- t .Assert (client .GetContent (ctx , "/api/v1/custom-test3?age=18&name=john" ), `{"code":0,"message":"","data":{"Id":1,"Age":18}}` )
192
- t .Assert (client .GetContent (ctx , "/api/v1/custom-test4?age=18&name=john" ), `{"code":0,"message":"","data":{"Id":1,"Name":"john"}}` )
191
+ t .Assert (client .GetContent (ctx , "/api/v1/custom-test3?age=18&name=john" ), `{"code":0,"message":"OK ","data":{"Id":1,"Age":18}}` )
192
+ t .Assert (client .GetContent (ctx , "/api/v1/custom-test4?age=18&name=john" ), `{"code":0,"message":"OK ","data":{"Id":1,"Name":"john"}}` )
193
193
194
- t .Assert (client .GetContent (ctx , "/api/v2/custom-test1?age=18&name=john" ), `{"code":0,"message":"","data":{"Id":1,"Age":18}}` )
195
- t .Assert (client .GetContent (ctx , "/api/v2/custom-test2?age=18&name=john" ), `{"code":0,"message":"","data":{"Id":1,"Name":"john"}}` )
196
- t .Assert (client .GetContent (ctx , "/api/v2/custom-test3?age=18&name=john" ), `{"code":0,"message":"","data":{"Id":1,"Age":18}}` )
197
- t .Assert (client .GetContent (ctx , "/api/v2/custom-test4?age=18&name=john" ), `{"code":0,"message":"","data":{"Id":1,"Name":"john"}}` )
194
+ t .Assert (client .GetContent (ctx , "/api/v2/custom-test1?age=18&name=john" ), `{"code":0,"message":"OK ","data":{"Id":1,"Age":18}}` )
195
+ t .Assert (client .GetContent (ctx , "/api/v2/custom-test2?age=18&name=john" ), `{"code":0,"message":"OK ","data":{"Id":1,"Name":"john"}}` )
196
+ t .Assert (client .GetContent (ctx , "/api/v2/custom-test3?age=18&name=john" ), `{"code":0,"message":"OK ","data":{"Id":1,"Age":18}}` )
197
+ t .Assert (client .GetContent (ctx , "/api/v2/custom-test4?age=18&name=john" ), `{"code":0,"message":"OK ","data":{"Id":1,"Name":"john"}}` )
198
198
})
199
199
}
200
200
@@ -251,7 +251,7 @@ func Test_Issue1708(t *testing.T) {
251
251
`
252
252
t .Assert (
253
253
client .PostContent (ctx , "/test" , content ),
254
- `{"code":0,"message":"","data":{"page":0,"size":0,"targetType":"topic","targetId":10785,"test":[[{"name":"123"}]]}}` ,
254
+ `{"code":0,"message":"OK ","data":{"page":0,"size":0,"targetType":"topic","targetId":10785,"test":[[{"name":"123"}]]}}` ,
255
255
)
256
256
})
257
257
}
@@ -295,7 +295,7 @@ func Test_Custom_Slice_Type_Attribute(t *testing.T) {
295
295
`
296
296
t .Assert (
297
297
client .PostContent (ctx , "/test" , content ),
298
- `{"code":0,"message":"","data":{"Content":"{\"Id\":1,\"List\":{\"key\":[\"a\",\"b\",\"c\"]}}"}}` ,
298
+ `{"code":0,"message":"OK ","data":{"Content":"{\"Id\":1,\"List\":{\"key\":[\"a\",\"b\",\"c\"]}}"}}` ,
299
299
)
300
300
})
301
301
}
@@ -370,12 +370,12 @@ func Test_Router_Handler_Strict_WithGeneric(t *testing.T) {
370
370
client := g .Client ()
371
371
client .SetPrefix (fmt .Sprintf ("http://127.0.0.1:%d" , s .GetListenedPort ()))
372
372
373
- t .Assert (client .GetContent (ctx , "/test1?age=1" ), `{"code":0,"message":"","data":{"Age":{"Test":1}}}` )
374
- t .Assert (client .GetContent (ctx , "/test1_slice?age=1" ), `{"code":0,"message":"","data":[{"Age":{"Test":1}}]}` )
375
- t .Assert (client .GetContent (ctx , "/test2?age=2" ), `{"code":0,"message":"","data":{"Test":2}}` )
376
- t .Assert (client .GetContent (ctx , "/test2_slice?age=2" ), `{"code":0,"message":"","data":[{"Test":2}]}` )
377
- t .Assert (client .GetContent (ctx , "/test3?age=3" ), `{"code":0,"message":"","data":{"Test":3}}` )
378
- t .Assert (client .GetContent (ctx , "/test3_slice?age=3" ), `{"code":0,"message":"","data":[{"Test":3}]}` )
373
+ t .Assert (client .GetContent (ctx , "/test1?age=1" ), `{"code":0,"message":"OK ","data":{"Age":{"Test":1}}}` )
374
+ t .Assert (client .GetContent (ctx , "/test1_slice?age=1" ), `{"code":0,"message":"OK ","data":[{"Age":{"Test":1}}]}` )
375
+ t .Assert (client .GetContent (ctx , "/test2?age=2" ), `{"code":0,"message":"OK ","data":{"Test":2}}` )
376
+ t .Assert (client .GetContent (ctx , "/test2_slice?age=2" ), `{"code":0,"message":"OK ","data":[{"Test":2}]}` )
377
+ t .Assert (client .GetContent (ctx , "/test3?age=3" ), `{"code":0,"message":"OK ","data":{"Test":3}}` )
378
+ t .Assert (client .GetContent (ctx , "/test3_slice?age=3" ), `{"code":0,"message":"OK ","data":[{"Test":3}]}` )
379
379
})
380
380
}
381
381
@@ -415,7 +415,7 @@ func Test_Router_Handler_Strict_ParameterCaseSensitive(t *testing.T) {
415
415
for i := 0 ; i < 1000 ; i ++ {
416
416
t .Assert (
417
417
client .PostContent (ctx , "/api/111" , `{"Path":"222"}` ),
418
- `{"code":0,"message":"","data":{"Path":"222"}}` ,
418
+ `{"code":0,"message":"OK ","data":{"Path":"222"}}` ,
419
419
)
420
420
}
421
421
})
@@ -474,10 +474,10 @@ func Test_JsonRawMessage_Issue3449(t *testing.T) {
474
474
},
475
475
}
476
476
477
- expect1 := `{"code":0,"message":"","data":{"name":"test","jsonRaw":[{"jkey1":"11","jkey2":"12"},{"jkey1":"21","jkey2":"22"}]}}`
477
+ expect1 := `{"code":0,"message":"OK ","data":{"name":"test","jsonRaw":[{"jkey1":"11","jkey2":"12"},{"jkey1":"21","jkey2":"22"}]}}`
478
478
t .Assert (client .PostContent (ctx , "/test" , data ), expect1 )
479
479
480
- expect2 := `{"code":0,"message":"","data":{"name":"test","jsonRaw":{"jkey1":"11","jkey2":"12"}}}`
480
+ expect2 := `{"code":0,"message":"OK ","data":{"name":"test","jsonRaw":{"jkey1":"11","jkey2":"12"}}}`
481
481
t .Assert (client .PostContent (ctx , "/test" , map [string ]any {
482
482
"Name" : "test" ,
483
483
"jsonRaw" : v1 ,
@@ -524,13 +524,13 @@ func Test_NullString_Issue3465(t *testing.T) {
524
524
"name" : "null" ,
525
525
}
526
526
527
- expect1 := `{"code":0,"message":"","data":{"name":["null"]}}`
527
+ expect1 := `{"code":0,"message":"OK ","data":{"name":["null"]}}`
528
528
t .Assert (client .GetContent (ctx , "/test" , data1 ), expect1 )
529
529
530
530
data2 := map [string ]any {
531
531
"name" : []string {"null" , "null" },
532
532
}
533
- expect2 := `{"code":0,"message":"","data":{"name":["null","null"]}}`
533
+ expect2 := `{"code":0,"message":"OK ","data":{"name":["null","null"]}}`
534
534
t .Assert (client .GetContent (ctx , "/test" , data2 ), expect2 )
535
535
536
536
})
0 commit comments