Skip to content

Commit ecc7d43

Browse files
committed
Rename Blob|UploadEndpoint.upload() to .uploadFrom()
1 parent e1a12fd commit ecc7d43

4 files changed

Lines changed: 8 additions & 8 deletions

File tree

endpoints/raw/BlobEndpoint.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ test('download', async () => {
3737
await endpoint.download();
3838
});
3939

40-
test('upload', async () => {
40+
test('uploadFrom', async () => {
4141
const data = new Blob([new Uint8Array([1, 2, 3])], { type: 'mock/type' });
4242

4343
fetchMock.mockOnceIf(
@@ -48,5 +48,5 @@ test('upload', async () => {
4848
}
4949
);
5050

51-
await endpoint.upload(data);
51+
await endpoint.uploadFrom(data);
5252
});

endpoints/raw/BlobEndpoint.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export class BlobEndpoint extends Endpoint {
6363
* @throws {@link errors!AuthorizationError}: {@link http!HttpStatusCode.Forbidden}
6464
* @throws {@link errors!HttpError}: Other non-success status code
6565
*/
66-
async upload(blob: Blob, signal?: AbortSignal) {
66+
async uploadFrom(blob: Blob, signal?: AbortSignal) {
6767
await this.send(HttpMethod.Put, signal, { [HttpHeader.ContentType]: blob.type }, blob);
6868
}
6969

endpoints/raw/UploadEndpoint.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ beforeEach(() => {
99
fetchMock.resetMocks();
1010
});
1111

12-
test('uploadRaw', async () => {
12+
test('uploadFromRaw', async () => {
1313
const endpoint = new UploadEndpoint(new EntryEndpoint('http://localhost/'), 'endpoint');
1414
const data = new Blob([new Uint8Array([1, 2, 3])], { type: 'mock/type' });
1515

@@ -20,10 +20,10 @@ test('uploadRaw', async () => {
2020
return {};
2121
}
2222
);
23-
await endpoint.upload(data);
23+
await endpoint.uploadFrom(data);
2424
});
2525

26-
test('uploadForm', async () => {
26+
test('uploadFromForm', async () => {
2727
const endpoint = new UploadEndpoint(new EntryEndpoint('http://localhost/'), 'endpoint', 'data');
2828
const file = new File([new Uint8Array([1, 2, 3])], 'file.dat', { type: 'mock/type' });
2929

@@ -38,7 +38,7 @@ test('uploadForm', async () => {
3838
}
3939
);
4040

41-
await endpoint.upload(file);
41+
await endpoint.uploadFrom(file);
4242

4343
// Verify the FormData was populated correctly with file name and type
4444
expect(setSpy).toHaveBeenCalledWith('data', file, 'file.dat');

endpoints/raw/UploadEndpoint.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export class UploadEndpoint extends Endpoint {
2626
* @throws {@link errors!NotFoundError}: {@link http!HttpStatusCode.NotFound} or {@link http!HttpStatusCode.Gone}
2727
* @throws {@link errors!HttpError}: Other non-success status code
2828
*/
29-
async upload(blob: Blob | File, signal?: AbortSignal) {
29+
async uploadFrom(blob: Blob | File, signal?: AbortSignal) {
3030
const fileName = blob instanceof File ? blob.name : undefined;
3131

3232
if (this.formField) {

0 commit comments

Comments
 (0)