Skip to content

Commit 4f740a3

Browse files
committed
Finish cleaning up customHost params
1 parent 467806c commit 4f740a3

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

packages/storage/src/implementation/metadata.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ export function fromResourceString(
156156
export function downloadUrlFromResourceString(
157157
metadata: Metadata,
158158
resourceString: string,
159-
host?: string
159+
host: string
160160
): string | null {
161161
const obj = jsonObjectOrNull(resourceString);
162162
if (obj === null) {

packages/storage/src/implementation/url.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,10 @@
1818
/**
1919
* @fileoverview Functions to create and manipulate URLs for the server API.
2020
*/
21-
import { DEFAULT_HOST } from './constants';
2221
import { UrlParams } from './requestinfo';
2322

24-
export function makeUrl(urlPart: string, customHost?: string): string {
25-
return `https://${customHost ?? DEFAULT_HOST}/v0${urlPart}`;
23+
export function makeUrl(urlPart: string, host: string): string {
24+
return `https://${host}/v0${urlPart}`;
2625
}
2726

2827
export function makeQueryString(params: UrlParams): string {

packages/storage/test/unit/requests.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ describe('Firebase Storage > Requests', () => {
200200
const requestInfo = getMetadata(storageService, location, mappings);
201201
assertObjectIncludes(
202202
{
203-
url: makeUrl(url),
203+
url: makeUrl(url, storageService.host),
204204
method: 'GET',
205205
body: null,
206206
headers: {},
@@ -220,7 +220,7 @@ describe('Firebase Storage > Requests', () => {
220220
const requestInfo = list(storageService, locationRoot, '/');
221221
assertObjectIncludes(
222222
{
223-
url: makeUrl(locationNormalNoObjUrl),
223+
url: makeUrl(locationNormalNoObjUrl, storageService.host),
224224
method: 'GET',
225225
body: null,
226226
headers: {},
@@ -250,7 +250,7 @@ describe('Firebase Storage > Requests', () => {
250250
);
251251
assertObjectIncludes(
252252
{
253-
url: makeUrl(locationNoObjectUrl),
253+
url: makeUrl(locationNoObjectUrl, storageService.host),
254254
method: 'GET',
255255
body: null,
256256
headers: {},
@@ -317,7 +317,7 @@ describe('Firebase Storage > Requests', () => {
317317
const requestInfo = getDownloadUrl(storageService, location, mappings);
318318
assertObjectIncludes(
319319
{
320-
url: makeUrl(url),
320+
url: makeUrl(url, storageService.host),
321321
method: 'GET',
322322
body: null,
323323
headers: {},
@@ -352,7 +352,7 @@ describe('Firebase Storage > Requests', () => {
352352
);
353353
assertObjectIncludes(
354354
{
355-
url: makeUrl(url),
355+
url: makeUrl(url, storageService.host),
356356
method: 'PATCH',
357357
body: metadataString,
358358
headers: { 'Content-Type': metadataContentType },
@@ -383,7 +383,7 @@ describe('Firebase Storage > Requests', () => {
383383
const requestInfo = deleteObject(storageService, location);
384384
assertObjectIncludes(
385385
{
386-
url: makeUrl(url),
386+
url: makeUrl(url, storageService.host),
387387
method: 'DELETE',
388388
body: null,
389389
headers: {},
@@ -448,7 +448,7 @@ describe('Firebase Storage > Requests', () => {
448448

449449
assertObjectIncludes(
450450
{
451-
url: makeUrl(url),
451+
url: makeUrl(url, storageService.host),
452452
method: 'POST',
453453
urlParams: { name: location.path },
454454
headers: {
@@ -493,7 +493,7 @@ describe('Firebase Storage > Requests', () => {
493493
);
494494
assertObjectIncludes(
495495
{
496-
url: makeUrl(url),
496+
url: makeUrl(url, storageService.host),
497497
method: 'POST',
498498
urlParams: { name: location.path },
499499
headers: {

0 commit comments

Comments
 (0)