Skip to content

Latest commit

 

History

History
40 lines (28 loc) · 1.07 KB

README.md

File metadata and controls

40 lines (28 loc) · 1.07 KB

Build Status Coverage Status Go Report Card License Repo Size

quickly test your HTTP requests

Usage

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!
}

License

The MIT License