diff --git a/package.json b/package.json index 3c1259e..57b7bc1 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,6 @@ "@openally/config.typescript": "1.2.1", "@types/lru-cache": "^7.10.9", "@types/node": "24.9.1", - "@types/statuses": "^2.0.6", "c8": "^10.1.3", "fastify": "5.6.1", "is-html": "3.2.0", @@ -47,7 +46,6 @@ "dependencies": { "@openally/result": "^1.2.1", "lru-cache": "11.2.2", - "statuses": "^2.0.2", "undici": "7.16.0" } } diff --git a/src/codes.ts b/src/codes.ts new file mode 100644 index 0000000..3e0dd62 --- /dev/null +++ b/src/codes.ts @@ -0,0 +1,65 @@ +export const statuses = { + 100: "Continue", + 101: "Switching Protocols", + 102: "Processing", + 103: "Early Hints", + 200: "OK", + 201: "Created", + 202: "Accepted", + 203: "Non-Authoritative Information", + 204: "No Content", + 205: "Reset Content", + 206: "Partial Content", + 207: "Multi-Status", + 208: "Already Reported", + 226: "IM Used", + 300: "Multiple Choices", + 301: "Moved Permanently", + 302: "Found", + 303: "See Other", + 304: "Not Modified", + 305: "Use Proxy", + 307: "Temporary Redirect", + 308: "Permanent Redirect", + 400: "Bad Request", + 401: "Unauthorized", + 402: "Payment Required", + 403: "Forbidden", + 404: "Not Found", + 405: "Method Not Allowed", + 406: "Not Acceptable", + 407: "Proxy Authentication Required", + 408: "Request Timeout", + 409: "Conflict", + 410: "Gone", + 411: "Length Required", + 412: "Precondition Failed", + 413: "Payload Too Large", + 414: "URI Too Long", + 415: "Unsupported Media Type", + 416: "Range Not Satisfiable", + 417: "Expectation Failed", + 418: "I'm a Teapot", + 421: "Misdirected Request", + 422: "Unprocessable Entity", + 423: "Locked", + 424: "Failed Dependency", + 425: "Too Early", + 426: "Upgrade Required", + 428: "Precondition Required", + 429: "Too Many Requests", + 431: "Request Header Fields Too Large", + 451: "Unavailable For Legal Reasons", + 500: "Internal Server Error", + 501: "Not Implemented", + 502: "Bad Gateway", + 503: "Service Unavailable", + 504: "Gateway Timeout", + 505: "HTTP Version Not Supported", + 506: "Variant Also Negotiates", + 507: "Insufficient Storage", + 508: "Loop Detected", + 509: "Bandwidth Limit Exceeded", + 510: "Not Extended", + 511: "Network Authentication Required" +}; diff --git a/src/request.ts b/src/request.ts index 719d987..5cd102e 100644 --- a/src/request.ts +++ b/src/request.ts @@ -5,10 +5,10 @@ import { URLSearchParams } from "node:url"; // Import Third-party Dependencies import * as undici from "undici"; import { Result } from "@openally/result"; -import status from "statuses"; // Import Internal Dependencies import * as Utils from "./utils.js"; +import { statuses } from "./codes.js"; import { computeURI } from "./agents.js"; import { HttpieResponseHandler, @@ -114,7 +114,7 @@ export async function request( const RequestResponse = { headers: requestResponse.headers, - statusMessage: status.message[requestResponse.statusCode]!, + statusMessage: statuses[requestResponse.statusCode]!, statusCode, data };