fix: 修正 JSON 标签中的空白字符

This commit is contained in:
hailaz
2025-09-18 11:19:49 +08:00
parent c68b828af9
commit c3a2a2f5f9
3 changed files with 12 additions and 2 deletions

View File

@ -1151,7 +1151,7 @@ func Test_NameFromJsonTag(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
type CreateReq struct {
gmeta.Meta `path:"/CreateReq" method:"POST"`
Name string `json:"nick_name, omitempty"`
Name string `json:"nick_name,omitempty"`
}
var (
@ -1172,7 +1172,7 @@ func Test_NameFromJsonTag(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
type CreateReq struct {
gmeta.Meta `path:"/CreateReq" method:"GET"`
Name string `json:"nick_name, omitempty" in:"header"`
Name string `json:"nick_name,omitempty" in:"header"`
}
var (
err error

View File

@ -1,3 +1,9 @@
// Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
//
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file,
// You can obtain one at https://github.com/gogf/gf.
package gconv_test
import (

View File

@ -70,6 +70,9 @@ var stringTests = []struct {
{gvar.New(123), "123"},
{gvar.New(123.456), "123.456"},
{myString("123"), "123"},
{(*myString)(nil), ""},
{goTime, "1911-10-10 00:00:00 +0000 UTC"},
{&goTime, "1911-10-10 00:00:00 +0000 UTC"},
// TODO The String method of gtime not equals to time.Time
@ -77,6 +80,7 @@ var stringTests = []struct {
{&gfTime, "1911-10-10 00:00:00"},
//{gfTime, "1911-10-10 00:00:00 +0000 UTC"},
//{&gfTime, "1911-10-10 00:00:00 +0000 UTC"},
}
var (