mirror of
https://github.com/coder/code-server.git
synced 2025-07-28 12:33:43 +08:00
Implement new structure
This commit is contained in:
24
src/common/http.ts
Normal file
24
src/common/http.ts
Normal file
@ -0,0 +1,24 @@
|
||||
export enum HttpCode {
|
||||
Ok = 200,
|
||||
Redirect = 302,
|
||||
NotFound = 404,
|
||||
BadRequest = 400,
|
||||
Unauthorized = 401,
|
||||
LargePayload = 413,
|
||||
ServerError = 500,
|
||||
}
|
||||
|
||||
export class HttpError extends Error {
|
||||
public constructor(message: string, public readonly code: number) {
|
||||
super(message)
|
||||
this.name = this.constructor.name
|
||||
}
|
||||
}
|
||||
|
||||
export enum ApiEndpoint {
|
||||
applications = "/applications",
|
||||
files = "/files",
|
||||
login = "/login",
|
||||
recent = "/recent",
|
||||
session = "/session",
|
||||
}
|
Reference in New Issue
Block a user