runtime.NewServeMux的 json的设置

runtime.NewServeMux的 json的设置

mux := runtime.NewServeMux(runtime.WithMarshalerOption(
		runtime.MIMEWildcard, &runtime.JSONPb{
			MarshalOptions:   protojson.MarshalOptions{
				UseProtoNames:     true, //使用 proto注解的name,一般都是下滑线的
				UseEnumNumbers:    true,//enum 转化成对对应的数字
			},
		}))

留下回复