acc50a5d36
* Update dependencies and force-update qs This is mainly an attempt to get rid of as many resolutions as possible since it seems they are unnecessary except for qs (according to yarn/npm audit). For qs use 6.9.7 since Express is using 6.9.6 and that matches the most closely. Also add overrides since this is npm's version of yarn's resolutions and we need it for the shrinkwrap to generate with the right dependencies. Decided to keep pinning @types/node as well although I am not sure it is necessary. Express is pulling in v20 types. Since this is development-only we only need it in resolutions. * Run formatter Some rules seem to have changed with the dependency updates. * Replace deprecated bodyParser.json() usage * Audit npm shrinkwrap as well * Skip installing dependencies in audit It seems the tools only require the lock files. * Fix tests when using ipv6 * Add missing openssl dependency to flake
30 lines
591 B
TypeScript
30 lines
591 B
TypeScript
export enum HttpCode {
|
|
Ok = 200,
|
|
Redirect = 302,
|
|
NotFound = 404,
|
|
BadRequest = 400,
|
|
Unauthorized = 401,
|
|
Forbidden = 403,
|
|
LargePayload = 413,
|
|
ServerError = 500,
|
|
}
|
|
|
|
/**
|
|
* Represents an error with a message and an HTTP status code. This code will be
|
|
* used in the HTTP response.
|
|
*/
|
|
export class HttpError extends Error {
|
|
public constructor(
|
|
message: string,
|
|
public readonly statusCode: HttpCode,
|
|
public readonly details?: object,
|
|
) {
|
|
super(message)
|
|
this.name = this.constructor.name
|
|
}
|
|
}
|
|
|
|
export enum CookieKeys {
|
|
Session = "code-server-session",
|
|
}
|