mirror of
https://github.com/go-kratos/kratos.git
synced 2026-05-22 10:15:24 +02:00
test(internal/context,internal/host) add test (#1334)
* test(internal/context,internal/host) add test
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package form
|
||||
|
||||
import (
|
||||
"github.com/go-kratos/kratos/v2/internal/test/testproto"
|
||||
"testing"
|
||||
|
||||
"github.com/go-kratos/kratos/v2/encoding"
|
||||
@@ -31,6 +32,14 @@ func TestFormCodecMarshal(t *testing.T) {
|
||||
content, err = encoding.GetCodec(contentType).Marshal(req)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, []byte("username=kratos"), content)
|
||||
|
||||
m := testproto.TestModel{
|
||||
Id: 1,
|
||||
Name: "kratos",
|
||||
}
|
||||
content, err = encoding.GetCodec(contentType).Marshal(m)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, []byte("id=1&name=kratos"), content)
|
||||
}
|
||||
|
||||
func TestFormCodecUnmarshal(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user