From 8565a1e0c1c7821360216c7a2303f0375615f73d Mon Sep 17 00:00:00 2001 From: tp Date: Mon, 12 Feb 2024 16:30:13 +0800 Subject: [PATCH] router: Tweak marshal options to EmitDefaultValues. --- router/response.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/router/response.go b/router/response.go index 39a1576..34e9de3 100644 --- a/router/response.go +++ b/router/response.go @@ -11,8 +11,17 @@ import ( ) var jpb = &protojson.MarshalOptions{ - UseEnumNumbers: false, - Indent: " ", + // Multiline: false, + Indent: " ", + // AllowPartial: false, + // UseProtoNames: false, + // UseEnumNumbers: false, + // EmitUnpopulated: false, + EmitDefaultValues: true, +} + +func SetMarshalOptions(opt *protojson.MarshalOptions) { + jpb = opt } // ProtoOK renders a 200 response with JSON-serialized proto