@@ -357,14 +357,18 @@ func readArguments(
357357 fixArguments func (args []reflect.Value , context ServiceContext ),
358358 reader * io.Reader ,
359359 method * Method ,
360+ hasArgs bool ,
360361 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 ()
366371 }
367- count := reader .ReadCount ()
368372 ft := method .Function .Type ()
369373 n := ft .NumIn ()
370374 if ft .IsVariadic () {
@@ -386,7 +390,9 @@ func readArguments(
386390 }
387391 }
388392 }
389- reader .ReadSlice (args [:count ])
393+ if hasArgs {
394+ reader .ReadSlice (args [:count ])
395+ }
390396 if ! ft .IsVariadic () && n > count {
391397 fixArguments (args , context )
392398 }
@@ -439,12 +445,14 @@ func (service *BaseService) doSingleInvoke(
439445 var args []reflect.Value
440446 if tag == io .TagList {
441447 reader .Reset ()
442- args = readArguments (service .FixArguments , reader , method , context )
448+ args = readArguments (service .FixArguments , reader , method , true , context )
443449 tag = reader .CheckTags ([]byte {io .TagTrue , io .TagEnd , io .TagCall })
444450 if tag == io .TagTrue {
445451 context .setByRef (true )
446452 tag = reader .CheckTags ([]byte {io .TagEnd , io .TagCall })
447453 }
454+ } else {
455+ args = readArguments (service .FixArguments , reader , method , false , context )
448456 }
449457 context .setMethod (method )
450458 result , err := service .beforeInvoke (name , args , context )
0 commit comments