quickly test your HTTP requests
package main
import (
"fmt"
"github.com/axetroy/mocker"
"github.com/gin-gonic/gin"
"net/http"
)
func main() {
gin.SetMode(gin.ReleaseMode)
router := gin.Default()
router.GET("/", func(context *gin.Context) {
context.String(http.StatusOK, "hello world!")
})
mock := mocker.New(router)
res := mock.Get("/", nil, nil)
fmt.Println(res.Body.String()) // hello world!
}
The MIT License