mirror of
https://github.com/go-kratos/kratos.git
synced 2026-05-22 10:15:24 +02:00
deps: middleware add separate go.mod and removes framework deps (#1385)
* deps: middleware add separate go.mod and removes framework deps
This commit is contained in:
@@ -4,8 +4,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/go-kratos/kratos/v2/encoding"
|
||||
"github.com/go-kratos/kratos/v2/internal/testproto/complex"
|
||||
testproto "github.com/go-kratos/kratos/v2/internal/testproto/encoding"
|
||||
"github.com/go-kratos/kratos/v2/internal/complex"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@@ -14,6 +13,11 @@ type LoginRequest struct {
|
||||
Password string `json:"password,omitempty"`
|
||||
}
|
||||
|
||||
type TestModel struct {
|
||||
ID int32 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
const contentType = "x-www-form-urlencoded"
|
||||
|
||||
func TestFormCodecMarshal(t *testing.T) {
|
||||
@@ -33,11 +37,12 @@ func TestFormCodecMarshal(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, []byte("username=kratos"), content)
|
||||
|
||||
m := testproto.TestModel{
|
||||
Id: 1,
|
||||
m := TestModel{
|
||||
ID: 1,
|
||||
Name: "kratos",
|
||||
}
|
||||
content, err = encoding.GetCodec(contentType).Marshal(m)
|
||||
t.Log(string(content))
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, []byte("id=1&name=kratos"), content)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user