Skip to content

Commit

Permalink
More build errors and cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkDuckworth committed Dec 20, 2023
1 parent a6c3460 commit 1ce5e4c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
4 changes: 2 additions & 2 deletions packages/firestore/src/remote/rest_connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export abstract class RestConnection implements Connection {
appCheckToken: Token | null
): Promise<Resp> {
const streamId = generateUniqueDebugId();
const url = this.makeUrl(rpcName, path.map(encodeURIComponent).join('/'));
const url = this.makeUrl(rpcName, path.toUriEncodedString());
logDebug(LOG_TAG, `Sending RPC '${rpcName}' ${streamId}:`, url, req);

const headers: StringMap = {
Expand Down Expand Up @@ -120,7 +120,7 @@ export abstract class RestConnection implements Connection {

invokeStreamingRPC<Req, Resp>(
rpcName: string,
path: string[],
path: ResourcePath,
request: Req,
authToken: Token | null,
appCheckToken: Token | null,
Expand Down
21 changes: 16 additions & 5 deletions packages/firestore/test/unit/remote/rest_connection.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { AppCheckToken, OAuthToken, Token } from '../../../src/api/credentials';
import { User } from '../../../src/auth/user';
import { DatabaseId, DatabaseInfo } from '../../../src/core/database_info';
import { SDK_VERSION } from '../../../src/core/version';
import { ResourcePath } from '../../../src/model/path';
import { Stream } from '../../../src/remote/connection';
import { RestConnection } from '../../../src/remote/rest_connection';
import { Code, FirestoreError } from '../../../src/util/error';
Expand Down Expand Up @@ -73,7 +74,9 @@ describe('RestConnection', () => {
it('url uses from path', async () => {
await connection.invokeRPC(
'Commit',
'projects/testproject/databases/(default)/documents'.split('/'),
new ResourcePath(
'projects/testproject/databases/(default)/documents'.split('/')
),
{},
null,
null
Expand All @@ -86,7 +89,9 @@ describe('RestConnection', () => {
it('merges headers', async () => {
await connection.invokeRPC(
'RunQuery',
'projects/testproject/databases/(default)/documents/foo'.split('/'),
new ResourcePath(
'projects/testproject/databases/(default)/documents/foo'.split('/')
),
{},
new OAuthToken('owner', User.UNAUTHENTICATED),
new AppCheckToken('some-app-check-token')
Expand All @@ -105,7 +110,9 @@ describe('RestConnection', () => {
it('empty app check token is not added to headers', async () => {
await connection.invokeRPC(
'RunQuery',
'projects/testproject/databases/(default)/documents/foo'.split('/'),
new ResourcePath(
'projects/testproject/databases/(default)/documents/foo'.split('/')
),
{},
null,
new AppCheckToken('')
Expand All @@ -124,7 +131,9 @@ describe('RestConnection', () => {
connection.nextResponse = Promise.resolve({ response: true });
const response = await connection.invokeRPC(
'RunQuery',
'projects/testproject/databases/(default)/documents/coll'.split('/'),
new ResourcePath(
'projects/testproject/databases/(default)/documents/coll'.split('/')
),
{},
null,
null
Expand All @@ -138,7 +147,9 @@ describe('RestConnection', () => {
return expect(
connection.invokeRPC(
'RunQuery',
'projects/testproject/databases/(default)/documents/coll'.split('/'),
new ResourcePath(
'projects/testproject/databases/(default)/documents/coll'.split('/')
),
{},
null,
null
Expand Down

0 comments on commit 1ce5e4c

Please sign in to comment.