Skip to content

Commit

Permalink
add NewRequestForTest
Browse files Browse the repository at this point in the history
  • Loading branch information
junqiang.zhang committed Jul 6, 2022
1 parent 9fa3de5 commit ece674a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 11 additions & 2 deletions gmock.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package gmock

import (
"github.com/sjqzhang/requests"
"github.com/sjqzhang/gmock/mockdb"
"github.com/sjqzhang/gmock/mockhttp"
"github.com/sjqzhang/gmock/mockredis"
"github.com/sjqzhang/gmock/util"
"github.com/sjqzhang/requests"
"net/http"
"net/http/httptest"
)

func NewMockHttpServer(httpServerPort int, mockJSONDir string, allowProxyHosts []string) *mockhttp.MockHttpServer {
Expand Down Expand Up @@ -33,10 +35,17 @@ func NewDBUtil() *util.DBUtil {
}

func Get(origurl string, args ...interface{}) (resp *requests.Response, err error) {

return requests.Get(origurl, args...)
}

func Post(origurl string, args ...interface{}) (resp *requests.Response, err error) {
return requests.Post(origurl, args...)
}

func NewRecorder() *httptest.ResponseRecorder {
return requests.NewRecorder()
}

func NewRequestForTest(method, origurl string, args ...interface{}) (*http.Request, error) {
return requests.NewRequestForTest(method,origurl,args...)
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ require (
github.com/pmezard/go-difflib v1.0.0
github.com/sirupsen/logrus v1.8.1
github.com/sjqzhang/goutil v0.0.2
github.com/sjqzhang/requests v1.0.0
github.com/sjqzhang/requests v1.0.4
github.com/stretchr/testify v1.7.0
github.com/syndtr/goleveldb v1.0.0
github.com/yuin/gopher-lua v0.0.0-20210529063254-f4c35e4016d9
Expand Down

0 comments on commit ece674a

Please sign in to comment.