Macaron: remove custom Request type (#37874)
* remove macaron.Request, use http.Request instead * remove com dependency from bindings module * fix another c.Req.Request
This commit is contained in:
@@ -8,7 +8,6 @@ import (
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"gopkg.in/macaron.v1"
|
||||
)
|
||||
|
||||
func TestBasicAuthenticatedRequest(t *testing.T) {
|
||||
@@ -16,11 +15,8 @@ func TestBasicAuthenticatedRequest(t *testing.T) {
|
||||
const expectedPass = "password"
|
||||
|
||||
t.Run("Given a valid set of basic auth credentials", func(t *testing.T) {
|
||||
httpReq, err := http.NewRequest("GET", "http://localhost:3000/metrics", nil)
|
||||
req, err := http.NewRequest("GET", "http://localhost:3000/metrics", nil)
|
||||
require.NoError(t, err)
|
||||
req := macaron.Request{
|
||||
Request: httpReq,
|
||||
}
|
||||
encodedCreds := encodeBasicAuthCredentials(expectedUser, expectedPass)
|
||||
req.Header.Set("Authorization", fmt.Sprintf("Basic %s", encodedCreds))
|
||||
authenticated := BasicAuthenticatedRequest(req, expectedUser, expectedPass)
|
||||
@@ -29,11 +25,8 @@ func TestBasicAuthenticatedRequest(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("Given an invalid set of basic auth credentials", func(t *testing.T) {
|
||||
httpReq, err := http.NewRequest("GET", "http://localhost:3000/metrics", nil)
|
||||
req, err := http.NewRequest("GET", "http://localhost:3000/metrics", nil)
|
||||
require.NoError(t, err)
|
||||
req := macaron.Request{
|
||||
Request: httpReq,
|
||||
}
|
||||
encodedCreds := encodeBasicAuthCredentials("invaliduser", "invalidpass")
|
||||
req.Header.Set("Authorization", fmt.Sprintf("Basic %s", encodedCreds))
|
||||
authenticated := BasicAuthenticatedRequest(req, expectedUser, expectedPass)
|
||||
|
||||
Reference in New Issue
Block a user