initial v4
Some checks failed
test / test (push) Failing after 1m53s

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2025-05-13 06:25:11 +03:00
parent 290f8a1f9a
commit f253aacfa1
73 changed files with 579 additions and 1534 deletions

View File

@@ -4,7 +4,7 @@ import (
"context"
"net/http"
httpsrv "go.unistack.org/micro-server-http/v3"
httpsrv "go.unistack.org/micro-server-http/v4"
pb "go.unistack.org/micro-tests/client/http/proto"
)

View File

@@ -15,19 +15,19 @@ import (
"sync"
"testing"
httpcli "go.unistack.org/micro-client-http/v3"
jsoncodec "go.unistack.org/micro-codec-json/v3"
jsonpbcodec "go.unistack.org/micro-codec-jsonpb/v3"
urlencodecodec "go.unistack.org/micro-codec-urlencode/v3"
xmlcodec "go.unistack.org/micro-codec-xml/v3"
vmeter "go.unistack.org/micro-meter-victoriametrics/v3"
httpsrv "go.unistack.org/micro-server-http/v3"
meterhandler "go.unistack.org/micro-server-http/v3/handler/meter"
httpcli "go.unistack.org/micro-client-http/v4"
jsoncodec "go.unistack.org/micro-codec-json/v4"
jsonpbcodec "go.unistack.org/micro-codec-jsonpb/v4"
urlencodecodec "go.unistack.org/micro-codec-urlencode/v4"
xmlcodec "go.unistack.org/micro-codec-xml/v4"
vmeter "go.unistack.org/micro-meter-victoriametrics/v4"
httpsrv "go.unistack.org/micro-server-http/v4"
meterhandler "go.unistack.org/micro-server-http/v4/handler/meter"
pb "go.unistack.org/micro-tests/server/http/proto"
"go.unistack.org/micro/v3/client"
"go.unistack.org/micro/v3/metadata"
mregister "go.unistack.org/micro/v3/register/memory"
"go.unistack.org/micro/v3/server"
"go.unistack.org/micro/v4/client"
"go.unistack.org/micro/v4/metadata"
mregister "go.unistack.org/micro/v4/register/memory"
"go.unistack.org/micro/v4/server"
wrapperspb "google.golang.org/protobuf/types/known/wrapperspb"
)
@@ -146,14 +146,14 @@ func NewServerHandlerWrapper(t *testing.T) server.HookHandler {
if !ok {
return errors.New("missing metadata")
}
if v, ok := imd.Get("Authorization"); ok && v == "test" {
if v, ok := imd.GetJoined("Authorization"); ok && v == "test" {
nmd.Set("my-key", "my-val")
nmd.Set("Content-Type", "text/xml")
httpsrv.SetRspCode(ctx, http.StatusUnauthorized)
return httpsrv.SetError(&pb.CallRsp{Rsp: "name_my_name"})
}
if v, ok := imd.Get("Test-Content-Type"); ok && v != "" {
if v, ok := imd.GetJoined("Test-Content-Type"); ok && v != "" {
nmd.Set("my-key", "my-val")
nmd.Set("Content-Type", v)
}
@@ -208,7 +208,7 @@ func (h *Handler) Call(ctx context.Context, req *pb.CallReq, rsp *pb.CallRsp) er
if req.Name != "my_name" {
h.t.Fatalf("invalid req received: %#+v", req)
}
if v, ok := md.Get("Authorization"); ok && v == "test" {
if v, ok := md.GetJoined("Authorization"); ok && v == "test" {
rsp.Rsp = "name_my_name"
httpsrv.SetRspCode(ctx, http.StatusUnauthorized)
omd.Set("my-key", "my-val")

View File

@@ -8,7 +8,7 @@ package pb
import (
context "context"
client "go.unistack.org/micro/v3/client"
client "go.unistack.org/micro/v4/client"
)
var (

View File

@@ -6,10 +6,10 @@ package pb
import (
context "context"
v31 "go.unistack.org/micro-client-http/v3"
v3 "go.unistack.org/micro-server-http/v3"
client "go.unistack.org/micro/v3/client"
server "go.unistack.org/micro/v3/server"
v31 "go.unistack.org/micro-client-http/v4"
v3 "go.unistack.org/micro-server-http/v4"
client "go.unistack.org/micro/v4/client"
server "go.unistack.org/micro/v4/server"
http "net/http"
time "time"
)