1
0
mirror of https://github.com/taigrr/wasm-experiments synced 2025-01-18 04:03:21 -08:00

Fix gRPC-Web test!

This commit is contained in:
Johan Brandhorst
2018-05-28 22:29:22 +01:00
parent d8c7440fdb
commit 8e0ab9aedb
9 changed files with 471 additions and 180 deletions

View File

@@ -3,6 +3,9 @@ package backend
import (
"context"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"github.com/johanbrandhorst/wasm-experiments/grpc/proto/server"
)
@@ -15,7 +18,10 @@ type Backend struct {
var _ server.BackendServer = (*Backend)(nil)
func (b Backend) GetUser(ctx context.Context, req *server.GetUserRequest) (*server.User, error) {
if req.GetUserId() != "1234" {
return nil, status.Error(codes.InvalidArgument, "invalid id")
}
return &server.User{
Id: "1234",
Id: req.GetUserId(),
}, nil
}