Skip to content

Commit 7c2199d

Browse files
authored
1 parent 0e690ec commit 7c2199d

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

messaging/topic_mgt.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ import (
2626

2727
const (
2828
iidEndpoint = "https://iid.googleapis.com/iid/v1"
29-
iidSubscribe = ":batchAdd"
30-
iidUnsubscribe = ":batchRemove"
29+
iidSubscribe = "batchAdd"
30+
iidUnsubscribe = "batchRemove"
3131
)
3232

3333
var iidErrorCodes = map[string]struct{ Code, Msg string }{
@@ -164,7 +164,7 @@ func (c *iidClient) makeTopicManagementRequest(ctx context.Context, req *iidRequ
164164

165165
request := &internal.Request{
166166
Method: http.MethodPost,
167-
URL: fmt.Sprintf("%s/%s", c.iidEndpoint, req.op),
167+
URL: fmt.Sprintf("%s:%s", c.iidEndpoint, req.op),
168168
Body: internal.NewJSONEntity(req),
169169
}
170170
var result iidResponse

messaging/topic_mgt_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func TestSubscribe(t *testing.T) {
4141
if err != nil {
4242
t.Fatal(err)
4343
}
44-
client.iidEndpoint = ts.URL
44+
client.iidEndpoint = ts.URL + "/v1"
4545

4646
resp, err := client.SubscribeToTopic(ctx, []string{"id1", "id2"}, "test-topic")
4747
if err != nil {
@@ -84,7 +84,7 @@ func TestUnsubscribe(t *testing.T) {
8484
if err != nil {
8585
t.Fatal(err)
8686
}
87-
client.iidEndpoint = ts.URL
87+
client.iidEndpoint = ts.URL + "/v1"
8888

8989
resp, err := client.UnsubscribeFromTopic(ctx, []string{"id1", "id2"}, "test-topic")
9090
if err != nil {
@@ -125,7 +125,7 @@ func TestTopicManagementError(t *testing.T) {
125125
if err != nil {
126126
t.Fatal(err)
127127
}
128-
client.iidEndpoint = ts.URL
128+
client.iidEndpoint = ts.URL + "/v1"
129129
client.iidClient.httpClient.RetryConfig = nil
130130

131131
cases := []struct {
@@ -185,7 +185,7 @@ func checkIIDRequest(t *testing.T, b []byte, tr *http.Request, op string) {
185185
if tr.Method != http.MethodPost {
186186
t.Errorf("Method = %q; want = %q", tr.Method, http.MethodPost)
187187
}
188-
wantOp := "/" + op
188+
wantOp := "/v1:" + op
189189
if tr.URL.Path != wantOp {
190190
t.Errorf("Path = %q; want = %q", tr.URL.Path, wantOp)
191191
}

0 commit comments

Comments
 (0)