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 转化成对对应的数字
			},
		}))

留下回复


Warning: is_dir(): open_basedir restriction in effect. File(/www/wwwroot/my-wordpress/index.php/2022/01/03/runtime-newservemux/) is not within the allowed path(s): (/www/wwwroot/my-wordpress/:/tmp/) in /www/wwwroot/my-wordpress/wp-content/plugins/matomo/classes/WpMatomo/AIBotTracking.php on line 175