@@ -357,14 +357,18 @@ func readArguments(
357
357
fixArguments func (args []reflect.Value , context ServiceContext ),
358
358
reader * io.Reader ,
359
359
method * Method ,
360
+ hasArgs bool ,
360
361
context ServiceContext ) (args []reflect.Value ) {
361
- if method != nil {
362
- reader .JSONCompatible = method .JSONCompatible
363
- }
364
- if method == nil || context .IsMissingMethod () {
365
- return reader .ReadSliceWithoutTag ()
362
+ count := 0
363
+ if hasArgs {
364
+ if method != nil {
365
+ reader .JSONCompatible = method .JSONCompatible
366
+ }
367
+ if method == nil || context .IsMissingMethod () {
368
+ return reader .ReadSliceWithoutTag ()
369
+ }
370
+ count = reader .ReadCount ()
366
371
}
367
- count := reader .ReadCount ()
368
372
ft := method .Function .Type ()
369
373
n := ft .NumIn ()
370
374
if ft .IsVariadic () {
@@ -386,7 +390,9 @@ func readArguments(
386
390
}
387
391
}
388
392
}
389
- reader .ReadSlice (args [:count ])
393
+ if hasArgs {
394
+ reader .ReadSlice (args [:count ])
395
+ }
390
396
if ! ft .IsVariadic () && n > count {
391
397
fixArguments (args , context )
392
398
}
@@ -439,12 +445,14 @@ func (service *BaseService) doSingleInvoke(
439
445
var args []reflect.Value
440
446
if tag == io .TagList {
441
447
reader .Reset ()
442
- args = readArguments (service .FixArguments , reader , method , context )
448
+ args = readArguments (service .FixArguments , reader , method , true , context )
443
449
tag = reader .CheckTags ([]byte {io .TagTrue , io .TagEnd , io .TagCall })
444
450
if tag == io .TagTrue {
445
451
context .setByRef (true )
446
452
tag = reader .CheckTags ([]byte {io .TagEnd , io .TagCall })
447
453
}
454
+ } else {
455
+ args = readArguments (service .FixArguments , reader , method , false , context )
448
456
}
449
457
context .setMethod (method )
450
458
result , err := service .beforeInvoke (name , args , context )
0 commit comments