是否对符号进行了编码?
作者: yiyue115创建于 2020年9月4日更新于 2025年10月9日
你好,我有一个结构体,格式如下:
type Response struct {
Url string protobuf:"bytes,1,opt,name=url,json=url,proto3" json:"url,omitempty"
XXX_NoUnkeyedLiteral struct{} json:"-"
XXX_unrecognized []byte json:"-"
XXX_sizecache int32 json:"-"
}
我将其设置为:
return &Response{
Url: "https://abcd.com/&abcd"
}
当我发出请求时,收到的响应如下:
{
"url": "https://abcd.com/\u0026abcd"
}
这里的 \u0026 应该是 &,但我不知道为什么它被编码了。我想知道grpcurl 是否会这样做?因为我没有在代码中找到任何进行编码的操作...
内容来源: fullstorydev/grpcurl