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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user