Skip to content

Commit 1ce5e4c

Browse files
committed
More build errors and cleanup.
1 parent a6c3460 commit 1ce5e4c

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

packages/firestore/src/remote/rest_connection.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export abstract class RestConnection implements Connection {
8989
appCheckToken: Token | null
9090
): Promise<Resp> {
9191
const streamId = generateUniqueDebugId();
92-
const url = this.makeUrl(rpcName, path.map(encodeURIComponent).join('/'));
92+
const url = this.makeUrl(rpcName, path.toUriEncodedString());
9393
logDebug(LOG_TAG, `Sending RPC '${rpcName}' ${streamId}:`, url, req);
9494

9595
const headers: StringMap = {
@@ -120,7 +120,7 @@ export abstract class RestConnection implements Connection {
120120

121121
invokeStreamingRPC<Req, Resp>(
122122
rpcName: string,
123-
path: string[],
123+
path: ResourcePath,
124124
request: Req,
125125
authToken: Token | null,
126126
appCheckToken: Token | null,

packages/firestore/test/unit/remote/rest_connection.test.ts

+16-5
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { AppCheckToken, OAuthToken, Token } from '../../../src/api/credentials';
2121
import { User } from '../../../src/auth/user';
2222
import { DatabaseId, DatabaseInfo } from '../../../src/core/database_info';
2323
import { SDK_VERSION } from '../../../src/core/version';
24+
import { ResourcePath } from '../../../src/model/path';
2425
import { Stream } from '../../../src/remote/connection';
2526
import { RestConnection } from '../../../src/remote/rest_connection';
2627
import { Code, FirestoreError } from '../../../src/util/error';
@@ -73,7 +74,9 @@ describe('RestConnection', () => {
7374
it('url uses from path', async () => {
7475
await connection.invokeRPC(
7576
'Commit',
76-
'projects/testproject/databases/(default)/documents'.split('/'),
77+
new ResourcePath(
78+
'projects/testproject/databases/(default)/documents'.split('/')
79+
),
7780
{},
7881
null,
7982
null
@@ -86,7 +89,9 @@ describe('RestConnection', () => {
8689
it('merges headers', async () => {
8790
await connection.invokeRPC(
8891
'RunQuery',
89-
'projects/testproject/databases/(default)/documents/foo'.split('/'),
92+
new ResourcePath(
93+
'projects/testproject/databases/(default)/documents/foo'.split('/')
94+
),
9095
{},
9196
new OAuthToken('owner', User.UNAUTHENTICATED),
9297
new AppCheckToken('some-app-check-token')
@@ -105,7 +110,9 @@ describe('RestConnection', () => {
105110
it('empty app check token is not added to headers', async () => {
106111
await connection.invokeRPC(
107112
'RunQuery',
108-
'projects/testproject/databases/(default)/documents/foo'.split('/'),
113+
new ResourcePath(
114+
'projects/testproject/databases/(default)/documents/foo'.split('/')
115+
),
109116
{},
110117
null,
111118
new AppCheckToken('')
@@ -124,7 +131,9 @@ describe('RestConnection', () => {
124131
connection.nextResponse = Promise.resolve({ response: true });
125132
const response = await connection.invokeRPC(
126133
'RunQuery',
127-
'projects/testproject/databases/(default)/documents/coll'.split('/'),
134+
new ResourcePath(
135+
'projects/testproject/databases/(default)/documents/coll'.split('/')
136+
),
128137
{},
129138
null,
130139
null
@@ -138,7 +147,9 @@ describe('RestConnection', () => {
138147
return expect(
139148
connection.invokeRPC(
140149
'RunQuery',
141-
'projects/testproject/databases/(default)/documents/coll'.split('/'),
150+
new ResourcePath(
151+
'projects/testproject/databases/(default)/documents/coll'.split('/')
152+
),
142153
{},
143154
null,
144155
null

0 commit comments

Comments
 (0)