Revision control
Copy as Markdown
/*
* Responses Test
*
* This specification is intended for testing purposes. It demonstrates various response media types.
*
* API version: 1.0.0
*/
package openapi
import (
"github.com/gin-gonic/gin"
)
type TestAPI struct {
}
// Get /v2/response/application/json/object
// Check response type application-json object
func (api *TestAPI) ApplicationJsonObjectResponse(c *gin.Context) {
resp := ApplicationJsonObjectResponse200Response{
Status: "OK",
Value: 22,
}
c.JSON(200, resp)
}
// Get /v2/response/application/json/string
// Check response type application-json string
func (api *TestAPI) ApplicationJsonStringResponse(c *gin.Context) {
c.JSON(200, gin.H{"status": "OK"})
}
// Get /v2/response/text/plain/string
// Check response type text/plain string
func (api *TestAPI) TextPlainStringResponse(c *gin.Context) {
c.Data(200, "text/plain", []byte("Hello plain text"))
}