Skip to content

如何优雅的裹一层json response #4298

Open
@Dcell

Description

@Dcell

在调研gin作为网关的可用性
我想针对其他服务返回的response,再裹一层json规范
例如:
{
"success":true
"data": #其他response
}

针对这种场景是使用了网上搜索的方式,添加一个 gin.HandlerFunc 中间,临时保存了 write 数据。但是看起来很简陋,不严谨。

请问有其他更加优雅的方式么

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions