Skip to content

Commit 8d7d4e3

Browse files
authored
Use protobuf in request and responses (#42)
1 parent a89bacb commit 8d7d4e3

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

pkg/internal/client.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111
"time"
1212

1313
v1 "github.com/optable/match-api/v2/gen/optable/external/v1"
14-
"google.golang.org/protobuf/encoding/protojson"
1514
"google.golang.org/protobuf/proto"
1615
)
1716

@@ -149,7 +148,7 @@ func (c *CleanroomClient) WaitForState(ctx context.Context, states []v1.Cleanroo
149148
}
150149

151150
func (c *CleanroomClient) do(ctx context.Context, req proto.Message) (*v1.Cleanroom, error) {
152-
msg, err := protojson.Marshal(req)
151+
msg, err := proto.Marshal(req)
153152
if err != nil {
154153
return nil, err
155154
}
@@ -172,7 +171,7 @@ func (c *CleanroomClient) do(ctx context.Context, req proto.Message) (*v1.Cleanr
172171
}
173172

174173
httpReq.Header.Add("Authorization", "Bearer "+c.token)
175-
httpReq.Header.Add("Content-Type", "application/json")
174+
httpReq.Header.Add("Content-Type", "application/protobuf")
176175

177176
httpResp, err := c.client.Do(httpReq)
178177
if err != nil {
@@ -190,7 +189,7 @@ func (c *CleanroomClient) do(ctx context.Context, req proto.Message) (*v1.Cleanr
190189
}
191190

192191
res := &v1.Cleanroom{}
193-
if err := protojson.Unmarshal(body, res); err != nil {
192+
if err := proto.Unmarshal(body, res); err != nil {
194193
return nil, err
195194
}
196195
return res, nil

0 commit comments

Comments
 (0)