1
0
mirror of https://github.com/go-kratos/kratos.git synced 2025-01-16 02:47:03 +02:00
kratos/transport/http/handle_test.go
Tony Chen b9f821c29f
transport/http: add http handler (#937)
* add http handler

* fix request error
2021-05-21 23:11:36 +08:00

25 lines
438 B
Go

package http
import (
"context"
"testing"
)
type HelloRequest struct {
Name string `json:"name"`
}
type HelloReply struct {
Message string `json:"message"`
}
type GreeterService struct {
}
func (s *GreeterService) SayHello(ctx context.Context, req *HelloRequest) (*HelloReply, error) {
return &HelloReply{Message: "hello " + req.Name}, nil
}
func TestHandler(t *testing.T) {
s := &GreeterService{}
_ = NewHandler(s.SayHello)
}