Skip to content

axetroy/mocker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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