Skip to content

Commit 131de5d

Browse files
committed
fix: failed unit test
1 parent e003cc4 commit 131de5d

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

handwritten/storage/src/storage-transport.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,11 @@ export class StorageTransport {
125125
callback?: StorageTransportCallback<T>,
126126
): Promise<void | T> {
127127
const headers = this.#buildRequestHeaders(reqOpts.headers);
128+
if (reqOpts.headers) {
129+
Object.entries(reqOpts.headers).forEach(([key, value]) => {
130+
headers.set(key, value as string);
131+
});
132+
}
128133
if (reqOpts[GCCL_GCS_CMD_KEY]) {
129134
headers.set(
130135
'x-goog-api-client',
@@ -137,11 +142,6 @@ export class StorageTransport {
137142
this.gaxiosInstance.interceptors.request.add(inter);
138143
}
139144
}
140-
if (reqOpts.headers) {
141-
Object.entries(reqOpts.headers).forEach(([key, value]) => {
142-
headers.set(key, value as string);
143-
});
144-
}
145145

146146
const isDelete = reqOpts.method?.toUpperCase() === 'DELETE';
147147
const urlString = reqOpts.url?.toString() || '';

handwritten/storage/test/resumable-upload.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ function mockAuthorizeRequest(
5959
access_token: 'abc123',
6060
},
6161
) {
62-
return nock('https://oauth2.googleapis.com').post('/token').reply(code, data);
62+
return nock('https://oauth2.googleapis.com')
63+
.post('/token', () => true)
64+
.reply(code, data);
6365
}
6466

6567
describe('resumable-upload', () => {

0 commit comments

Comments
 (0)