Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/platform/networking/common/fetcherService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export interface FetchOptions {
* the `Content-Type` header set to `application/json`.
*/
json?: unknown;
method?: 'GET' | 'POST';
method?: 'GET' | 'POST' | 'PUT';
signal?: IAbortSignal;
retryFallbacks?: boolean;
expectJSON?: boolean;
Expand Down
6 changes: 3 additions & 3 deletions src/platform/networking/node/baseFetchFetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ export abstract class BaseFetchFetcher implements IFetcher {
}

const method = options.method || 'GET';
if (method !== 'GET' && method !== 'POST') {
throw new Error(`Illegal arguments! 'method' must be either 'GET' or 'POST'!`);
if (method !== 'GET' && method !== 'POST' && method !== 'PUT') {
throw new Error(`Illegal arguments! 'method' must be 'GET', 'POST', or 'PUT'!`);
}

const signal = options.signal ?? new AbortController().signal;
Expand Down Expand Up @@ -81,7 +81,7 @@ export abstract class BaseFetchFetcher implements IFetcher {
return items;
}

private async _fetch(url: string, method: 'GET' | 'POST', headers: { [name: string]: string }, body: string | undefined, signal: AbortSignal): Promise<Response> {
private async _fetch(url: string, method: 'GET' | 'POST' | 'PUT', headers: { [name: string]: string }, body: string | undefined, signal: AbortSignal): Promise<Response> {
const resp = await this._fetchImpl(url, { method, headers, body, signal });
return new Response(
resp.status,
Expand Down
6 changes: 3 additions & 3 deletions src/platform/networking/node/nodeFetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ export class NodeFetcher implements IFetcher {
}

const method = options.method || 'GET';
if (method !== 'GET' && method !== 'POST') {
throw new Error(`Illegal arguments! 'method' must be either 'GET' or 'POST'!`);
if (method !== 'GET' && method !== 'POST' && method !== 'PUT') {
throw new Error(`Illegal arguments! 'method' must be 'GET', 'POST', or 'PUT'!`);
}

const signal = options.signal ?? new AbortController().signal;
Expand Down Expand Up @@ -86,7 +86,7 @@ export class NodeFetcher implements IFetcher {
return items;
}

private _fetch(url: string, method: 'GET' | 'POST', headers: { [name: string]: string }, body: string | undefined, signal: AbortSignal): Promise<Response> {
private _fetch(url: string, method: 'GET' | 'POST' | 'PUT', headers: { [name: string]: string }, body: string | undefined, signal: AbortSignal): Promise<Response> {
return new Promise((resolve, reject) => {
const module = url.startsWith('https:') ? https : http;
const req = module.request(url, { method, headers }, res => {
Expand Down
Loading