Add frontend speed test application and server setup
* Introduced a new HTML frontend for network speed testing with a responsive UI * Implemented backend server functionality to serve the frontend and handle speed test APIs * Added speed test logic for downloading and uploading data, including progress tracking and result validation * Created README-SPEEDTEST.md for documentation on application architecture, setup, and usage. * Updated package.json to include necessary scripts and dependencies for development and testing
This commit is contained in:
52
src/net/http/HttpMethod.ts
Normal file
52
src/net/http/HttpMethod.ts
Normal file
@@ -0,0 +1,52 @@
|
||||
import {assertUnreachable} from '@techniker-me/tools';
|
||||
|
||||
export enum HttpMethod {
|
||||
GET = 0,
|
||||
POST = 1,
|
||||
PUT = 2,
|
||||
DELETE = 3,
|
||||
PATCH = 4,
|
||||
OPTIONS = 5
|
||||
}
|
||||
|
||||
export type HttpMethodType = keyof typeof HttpMethod;
|
||||
|
||||
export class HttpMethodMapping {
|
||||
public static convertHttpMethodTypeToHttpMethod(method: HttpMethodType): HttpMethod {
|
||||
switch (method) {
|
||||
case 'GET':
|
||||
return HttpMethod.GET;
|
||||
case 'POST':
|
||||
return HttpMethod.POST;
|
||||
case 'PUT':
|
||||
return HttpMethod.PUT;
|
||||
case 'DELETE':
|
||||
return HttpMethod.DELETE;
|
||||
case 'PATCH':
|
||||
return HttpMethod.PATCH;
|
||||
case 'OPTIONS':
|
||||
return HttpMethod.OPTIONS;
|
||||
default:
|
||||
assertUnreachable(method);
|
||||
}
|
||||
}
|
||||
|
||||
public static convertHttpMethodToHttpMethodType(method: HttpMethod): HttpMethodType {
|
||||
switch (method) {
|
||||
case HttpMethod.GET:
|
||||
return 'GET';
|
||||
case HttpMethod.POST:
|
||||
return 'POST';
|
||||
case HttpMethod.PUT:
|
||||
return 'PUT';
|
||||
case HttpMethod.DELETE:
|
||||
return 'DELETE';
|
||||
case HttpMethod.PATCH:
|
||||
return 'PATCH';
|
||||
case HttpMethod.OPTIONS:
|
||||
return 'OPTIONS';
|
||||
default:
|
||||
assertUnreachable(method);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user