|
@@ -20,7 +20,6 @@ import (
|
|
|
"github.com/gin-contrib/sse"
|
|
"github.com/gin-contrib/sse"
|
|
|
"github.com/gin-gonic/gin/binding"
|
|
"github.com/gin-gonic/gin/binding"
|
|
|
"github.com/gin-gonic/gin/render"
|
|
"github.com/gin-gonic/gin/render"
|
|
|
- "github.com/golang/protobuf/proto"
|
|
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
// Content-Type MIME of the most common data formats.
|
|
// Content-Type MIME of the most common data formats.
|
|
@@ -784,6 +783,11 @@ func (c *Context) YAML(code int, obj interface{}) {
|
|
|
c.Render(code, render.YAML{Data: obj})
|
|
c.Render(code, render.YAML{Data: obj})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// ProtoBuf serializes the given struct as ProtoBuf into the response body.
|
|
|
|
|
+func (c *Context) ProtoBuf(code int, obj interface{}) {
|
|
|
|
|
+ c.Render(code, render.ProtoBuf{Data: obj})
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
// String writes the given string into the response body.
|
|
// String writes the given string into the response body.
|
|
|
func (c *Context) String(code int, format string, values ...interface{}) {
|
|
func (c *Context) String(code int, format string, values ...interface{}) {
|
|
|
c.Render(code, render.String{Format: format, Data: values})
|
|
c.Render(code, render.String{Format: format, Data: values})
|
|
@@ -846,11 +850,6 @@ func (c *Context) Stream(step func(w io.Writer) bool) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// ProtoBuf serializes the given struct as ProtoBuf into the response body.
|
|
|
|
|
-func (c *Context) ProtoBuf(code int, obj proto.Message) {
|
|
|
|
|
- c.Render(code, render.ProtoBuf{Data: obj})
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
/************************************/
|
|
/************************************/
|
|
|
/******** CONTENT NEGOTIATION *******/
|
|
/******** CONTENT NEGOTIATION *******/
|
|
|
/************************************/
|
|
/************************************/
|