From ac0357ca6c2835c2b6fa3ac7f680efc063e696ff Mon Sep 17 00:00:00 2001 From: Alec Sammon Date: Sat, 18 May 2024 10:00:42 +0100 Subject: [PATCH] * use rtm.Directive.Argv --- core/formencoder.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/core/formencoder.go b/core/formencoder.go index 788b3b9..76f77be 100644 --- a/core/formencoder.go +++ b/core/formencoder.go @@ -2,7 +2,7 @@ package core import ( "github.com/ggicci/httpin/internal" - "strings" + "slices" ) type FormEncoder struct { @@ -10,8 +10,7 @@ type FormEncoder struct { } func (e *FormEncoder) Execute(rtm *DirectiveRuntime) error { - tag := rtm.Resolver.Field.Tag.Get("in") - if rtm.Value.IsZero() && strings.Contains(tag, "omitempty") { + if rtm.Value.IsZero() && slices.Contains(rtm.Directive.Argv, "omitempty") { return nil }