18 lines
287 B
Go
18 lines
287 B
Go
|
|
package middleware
|
||
|
|
|
||
|
|
import (
|
||
|
|
"github.com/gin-gonic/gin"
|
||
|
|
)
|
||
|
|
|
||
|
|
const (
|
||
|
|
contentTypeHeader = "Content-Type"
|
||
|
|
jsonContentType = "application/json"
|
||
|
|
)
|
||
|
|
|
||
|
|
func JsonAPI() gin.HandlerFunc {
|
||
|
|
return func(c *gin.Context) {
|
||
|
|
c.Writer.Header().Set(contentTypeHeader, jsonContentType)
|
||
|
|
c.Next()
|
||
|
|
}
|
||
|
|
}
|