update after protoc-gen-micro changes

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2021-02-27 13:51:39 +03:00
parent c5fb53c0f1
commit 267b29b658
28 changed files with 394 additions and 517 deletions

View File

@@ -2,9 +2,10 @@ package handler
import (
"context"
"net/http"
httpsrv "github.com/unistack-org/micro-server-http/v3"
pb "github.com/unistack-org/micro-tests/client/http/proto"
"net/http"
)
type GithubHandler struct{}
@@ -16,7 +17,7 @@ func NewGithubHandler() *GithubHandler {
func (h *GithubHandler) LookupUser(ctx context.Context, req *pb.LookupUserReq, rsp *pb.LookupUserRsp) error {
if req.GetUsername() == "" || req.GetUsername() != "vtolstov" {
httpsrv.SetRspCode(ctx, http.StatusBadRequest)
return &pb.Error{Message: "name is not correct"}
return httpsrv.SetError(&pb.Error{Message: "name is not correct"})
}
rsp.Name = "Vasiliy Tolstov"
httpsrv.SetRspCode(ctx, http.StatusOK)