{"id":20426209,"url":"https://github.com/vldr/iismodulejs","last_synced_at":"2026-05-29T06:31:29.351Z","repository":{"id":56587481,"uuid":"228495626","full_name":"vldr/IISModuleJS","owner":"vldr","description":"A middleware for IIS that allows you to harness the power and convenience of JavaScript for each request.","archived":false,"fork":false,"pushed_at":"2020-10-25T08:41:43.000Z","size":1747,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-05T05:17:21.361Z","etag":null,"topics":["iis","iis-server","javascript","middleware","v8"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vldr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-12-16T23:44:07.000Z","updated_at":"2024-03-16T04:14:08.000Z","dependencies_parsed_at":"2022-08-15T21:30:59.028Z","dependency_job_id":null,"html_url":"https://github.com/vldr/IISModuleJS","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/vldr/IISModuleJS","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vldr%2FIISModuleJS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vldr%2FIISModuleJS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vldr%2FIISModuleJS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vldr%2FIISModuleJS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vldr","download_url":"https://codeload.github.com/vldr/IISModuleJS/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vldr%2FIISModuleJS/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33640627,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-29T02:00:06.066Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["iis","iis-server","javascript","middleware","v8"],"created_at":"2024-11-15T07:15:53.402Z","updated_at":"2026-05-29T06:31:29.332Z","avatar_url":"https://github.com/vldr.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"logo.svg\" /\u003e\nA middleware for IIS (Internet Information Services) that allows you to harness the power and convenience of JavaScript for each request.\n\n# \n\n# Dependencies\n* [v8](https://github.com/v8/v8) (included precompiled library file in [releases](../../releases))\n* [rpclib](https://github.com/rpclib/rpclib) (included precompiled library file in [releases](../../releases))\n* [openssl](https://github.com/openssl/openssl) (included precompiled library file in [releases](../../releases))\n* [libcppdb](http://cppcms.com/sql/cppdb/index.html) (included precompiled library file in [releases](../../releases))\n* [sqlite3](https://www.sqlite.org/index.html) (included precompiled library file in [releases](../../releases))\n* [httplib](https://github.com/yhirose/cpp-httplib) \n* [v8pp](https://github.com/pmed/v8pp) \n* [simdb](https://github.com/LiveAsynchronousVisualizedArchitecture/simdb)\n\n# Getting Started\n### Installation\n1. Download *iismodulejs.64.dll* from the [releases](../../releases) page.\n2. Follow the instructions given [here](https://docs.microsoft.com/en-us/iis/develop/runtime-extensibility/develop-a-native-cc-module-for-iis#deploying-a-native-module) to install the dynamic-link library in IIS.\n### Running Scripts\nAll scripts are executed from the `%PUBLIC%` directory. The module watches each script for changes and dynamically reloads a script if a change was found. \n\nScripts should be named with their corresponding [application pool name](https://blogs.msdn.microsoft.com/rohithrajan/2017/10/08/quick-reference-iis-application-pool/). For example, the site `vldr.org` would likely have the application pool name `vldr_org` thus the script should be named `vldr_org.js`\n\nYou can load as many subsequent scripts as you want using the [load](#load) function.\n\n# API\n\n### **Register**\n\n```javascript\nregister(\n    callbackType?: number,\n    callback: (response: IISResponse, request: IISRequest, flag: number) \n    =\u003e number | Promise\u003cnumber\u003e\n): void\n```\n\nRegisters a given function as a callback which will be called for every request.\n\nYour callback function will be provided a [Response](#response) object, and a [Request](#request) object respectively. \n\n#\n\nTypes of callbacks (**callbackType**):\n\n**BEGIN_REQUEST:**\n\u003cp\u003e\nThis callback is called at the start of every request to your IIS server. This means that IIS has placed the request into the pipeline and will (unless told otherwise by returning FINISH) pass this request to other modules (PHP, CGI, static file handler, etc).\n    \n**Note:** This is the default callback and should be used in most cases. All features will work except [response.read](#read-1) and [request.setUrl](#seturl)\u003c/b\u003e.\u003c/p\u003e\n\n**SEND_RESPONSE:**\n\u003cp\u003e\nThis callback is called when IIS sends the response body to clients. This means if you want to read the response body after modules (i.e. PHP, static file handler) have written to it then this callback must be used. \n\nAlso, this is the only callback which provides an extra parameter \u003cb\u003eflag\u003c/b\u003e which you can learn more about [here.](https://docs.microsoft.com/en-us/iis/web-development-reference/native-code-api-reference/isendresponseprovider-getflags-method#remarks)\u003c/p\u003e\n\n**PRE_BEGIN_REQUEST:**\n\u003cp\u003e\nThis callback is also called at the start of every request to your IIS server, but unlike BEGIN_REQUEST, it is called before IIS has placed the request into the pipeline and \u003cb\u003eCANNOT\u003c/b\u003e be asynchronous. Therefore this callback should be used to achieve high performance filtering and processing at the cost of losing various features. \n    \n**Note:** Many features might not work in this callback, and some features will only work in this callback like [request.setUrl](#seturl).\u003c/p\u003e\n#\n\nYour callback function must return either **CONTINUE** (0) or **FINISH** (1), which are provided in the runtime environment:\n- Use **CONTINUE** if you want the request to continue to other modules and the rest of the pipeline.\n- Use **FINISH** if you want the request to be handled only by yourself.\n\nThe callback function can also be asynchronous (except for **PRE_BEGIN_REQUEST**) but keep in mind that this will yield far **worse** performance than using a synchronous function.\n\n**Example:**\n```javascript\nfunction callback(response, request) \n{\n    return CONTINUE;\n}\n\nregister(callback);\n```\n\n#\n\n### **Load**\n\n```javascript\nload(...fileName: string[]): void\n```\nLoads a script using **fileName** as the name of the JavaScript file, the name should include the extension.\n\n**Example:**\n\n```javascript\n// Loads a single script.\nload(\"script.js\");\n\n// Load multiple scripts.\nload(\"script.js\", \"script2.js\");\n```\n\n#\n\n### **Print**\n\n```javascript\nprint(...msg: string[]): void\n```\nPrints **msg** using OutputDebugString. You can observe the print out using a debugger or [DebugView](https://docs.microsoft.com/en-us/sysinternals/downloads/debugview).\n\n**Example:**\n```javascript\n// Prints \"test message.\"\nprint(\"test message\");\n\n// Prints \"test message and then some.\"\nprint(\"test message\", \"and then some\");\n```\n\n\n## IPC\nThe interprocess communication interface provides a key-value store where you can share JavaScript data across different processes/workers.\n\n### **Set**\n\n```javascript\nipc.set(key: string, value: any): void\n```\n\nSets a **key** with a given **value**.\n\n**Example:**\n```javascript\nregister((response, request) =\u003e \n{\n    // Get our client's ip address.\n    const ip = request.getRemoteAddress();\n    \n    // An example object.\n    const object = { \n        number: 3.14,\n        text: \"sample text\",\n        array: [ 3.14, \"sample text\" ]\n    };\n    \n    // Set our key-value.\n    ipc.set(\n        ip, \n        object\n    ); \n    \n    return CONTINUE;\n});\n```\n\n#\n\n### **Get**\n\n```ts\nipc.get(key: string): any | null\n```\nReturns a value with the corresponding **key**.\n\nThis function will return *null* if the key does not exist, make sure to check for it.\n\n**Example:**\n\n```javascript\nregister((response, request) =\u003e \n{\n    // Get our client's ip address.\n    const ip = request.getRemoteAddress();\n    \n    // Get our value.\n    const value = ipc.get(ip);\n    \n    // Check if our value exists.\n    if (value)\n    {\n        // Will print out our value.\n        print(\n            JSON.stringify(\n                value\n            )\n        );\n    }\n    \n    return CONTINUE;\n});\n```\n\n\n## HTTP\n\n### **Fetch**\n\n```ts\nfetch(\n    hostname: string, \n    path: string, \n    init?: FetchRequestInit\n): Promise\u003cFetchResponse\u003e\n```\n\nThis function provides an interface for fetching resources. This function (while similar) should **not** be mistaken for the [fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) found in the standard web api.\n\nThe **hostname** parameter specifies the domain name of the server.\u003cbr\u003e\nThe **path** parameter specifies the path part of the HTTP request. \u003cbr\u003e\nThe **init** parameter specifies the [FetchRequestInit](#FetchRequestInit-Object) object which is optional.\n\nThe function returns a Promise which will yield a [FetchResponse](#FetchResponse-Object)\n\nThe example below requires some familiarity with [Promises](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises). This example strictly demonstrates how an async callback can be used, but you can mix async and non-async functions depending on your needs.\n```javascript\nregister(\n    // Notice how we're using an asynchronous callback,\n    // this is because we'd like the response from our http.fetch\n    // to be written to the request's body as soon it arrives (using await).\n    async (response, request) =\u003e \n    {\n        // Attempts to fetch the latest comic from xkcd, \n        // notice how our isSSL is set to true since the api endpoint\n        // is HTTPS.\n        await http.fetch(\"xkcd.com\", \"/info.0.json\", { is_ssl: true })\n            .then((reply) =\u003e {\n                // Write our response using the reply body.\n                response.write(reply.blob(), \"application/json\");\n            })\n            .catch((error) =\u003e {\n                // Write our error as the response.\n                response.write(\"An error occurred while fetching.\", \"text/html\");\n            });\n    \n        // Finish our request since we want our response to be written.\n        return FINISH;\n    }\n);\n```\n#\n\n#### FetchRequestInit Object\nThis object represents the initialization information for the http.fetch function call.\nAllows to set any custom settings that you want to apply to the request.\n\nThe **body** accessor is the body of the request.\u003cbr\u003e\nThe **method** accessor is the request method, e.g., GET, POST. \u003cbr\u003e\nThe **is_ssl** accessor represents whether the request is connecting to a TLS enabled endpoint.\u003cbr\u003e\nThe **headers** accessor represents a key-value object (ordinary JS object) which will be used as the headers for the request.\n\n```ts\ninterface FetchRequestInit {\n    body?: string,\n    method?: number,\n    is_ssl?: boolean,\n    headers?: string[][]\n}\n```\n\n#\n\n#### FetchResponse Object\nThis object represents the response from the http.fetch function call. \n\nThe **status()** method returns the status code of the response.\u003cbr\u003e\nThe **text()** method returns the response body as a **string** if it exists otherwise **null**.\u003cbr\u003e\nThe **blob()** method returns the response body as a **Uint8Array** if it exists otherwise **null**.\u003cbr\u003e\nThe **headers()** method returns the response headers as an object.\n\n```ts\ninterface FetchResponse {\n    status(): number,\n    text(): string | null,\n    blob(): Uint8Array | null,\n    headers(): Object\n}\n```\n\n## Request\n\n### **Read**\n\n```ts\nread(rewrite?: boolean): string\n```\n\nReturns the HTTP request body as a String. \n\nThe **rewrite** parameter determines whether to rewrite all the data back into the pipeline; set this to *true* if you expect to let the request continue to PHP or any other module which will use the request data. \n\n**Note:** Setting rewrite to *true* will yield far worse performance.\n\n**Example:**\n\n```javascript\nregister((response, request) =\u003e \n{\n    // Reads the request body with rewrite set to true.\n    let body = request.read(true); \n    \n    // Prints out the body.\n    print(\n        body\n    );\n    \n    ////////////////////////////////////\n    \n    // Reads the request body with rewrite set to false (default).\n    body = request.read(); \n    \n    // Prints out the body.\n    print(\n        body\n    );\n    \n    ////////////////////////////////////\n    \n    // Reads the request body once again but since we didn't rewrite the \n    // request body back into the pipeline our result will be null.\n    body = request.read(); \n    \n    // Prints out 'null'.\n    print(\n        body\n    );\n\n    // End the request here. \n    return FINISH;\n});\n```\n#\n\n### **SetURL**\n\n```ts\nsetUrl(url: string, resetQuerystring?: boolean): void\n```\nSet a new URL for the request. Can be used to rewrite urls but is **not** recommended because the setUrl method is called after the initial parameters for\n the request have been gathered, so subsequent request processing may be unaware of the changed URL.  \n\nThe **url** parameter specifies to which path to rewrite the request to.\u003cbr\u003e\nThe **resetQuerystring** parameter specifies whether to reset query string(s) associated with the request (erase them entirely).\n\n**Note:** You should only call SetUrl in the **PRE_BEGIN_REQUEST** callback, otherwise it will likely not function properly. \n\n**Example:**\n```javascript\nregister(PRE_BEGIN_REQUEST, (response, request) =\u003e \n{\n    request.setUrl(\"/example\", false);\n    \n    return CONTINUE;\n});\n```\n\n#\n\n### **SetHeader**\n\n```ts\nsetHeader(headerName: string, headerValue: string, shouldReplace?: boolean): void\n```\nSets or appends the value of a specified HTTP request header. \n\nThe **headerName** parameter defines the name of the header, example: \"Content-Type.\"\u003cbr\u003e\nThe **headerValue** parameter sets the value of the header, example: \"text/html.\"\u003cbr\u003e\nThe **shouldReplace** parameter determines whether to replace the value of a preexisting header or to append to it. \n\n**Example:**\n\n```javascript\nregister((response, request) =\u003e \n{\n    // This will replace the 'User-Agent' header with the value 'custom server value'\n    request.setHeader('User-Agent', 'custom server value');\n\n    // This will append 'custom server value 2' to the 'User-Agent' header.\n    request.setHeader('User-Agent', 'custom server value 2', false);\n    \n    return CONTINUE;\n});\n```\n#\n\n### **GetHeader**\n\n```ts \ngetHeader(headerName: string): string | null\n```\n\nReturns the value of a specified HTTP header. \nIf the header doesn't exist this function will return *null* so make sure to check for it.\n\n\n**Example:**\n\n```javascript\nregister((response, request) =\u003e \n{\n    // Gets the value of the User-Agent header.\n    const userAgent = request.getHeader('User-Agent');\n    \n    // Check if our header exists.\n    if (userAgent)\n        // Prints out for example \"Mozilla/5.0 (iPhone; CPU iPhone OS 12_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0 Mobile/15E148 Safari/604.1\"\n        print(userAgent);\n   \n    return CONTINUE;\n});\n```\n#\n\n### **DeleteHeader**\n\n```ts \ndeleteHeader(headerName: String): void\n```\nDeletes an HTTP header from the request.\n\n**Example:**\n\n```javascript\nregister((response, request) =\u003e \n{\n    request.deleteHeader('Server');\n\n    return CONTINUE;\n});\n```\n#\n\n### **GetHost**\n\n```ts \ngetHost(): String\n```\nReturns the host section of the URL for the request.\n\n**Example:**\n\n```javascript\nregister((response, request) =\u003e \n{\n    // If the full url is \"http://127.0.0.1/this/is/a/absolute/path?this=is\u0026a=query\u0026string\"\n    // then this will print out \"127.0.0.1:80\"\n    print(\n        request.getHost()\n    );\n\n    return CONTINUE;\n});\n```\n#\n\n\n### **GetQueryString**\n\n```ts \ngetQueryString(): String\n```\nReturns the query string for the request. \n\n**Example:**\n\n```javascript\nregister((response, request) =\u003e \n{\n    // If the full url is \"http://127.0.0.1/this/is/a/absolute/path?this=is\u0026a=query\u0026string\"\n    // then this will print out \"?this=is\u0026a=query\u0026string\"\n    print(\n        request.getQueryString()\n    );\n\n    return CONTINUE;\n});\n```\n#\n\n### **GetFullUrl**\n\n```ts \ngetFullUrl(): String\n```\nReturns the full url for the request. \n\n**Example:**\n\n```javascript\nregister((response, request) =\u003e \n{\n    // If the full url is \"http://127.0.0.1/this/is/a/absolute/path?this=is\u0026a=query\u0026string\"\n    // then this will print out \"http://127.0.0.1:80/this/is/a/absolute/path?this=is\u0026a=query\u0026string\"\n    print(\n        request.getFullUrl()\n    );\n\n    return CONTINUE;\n});\n```\n#\n\n### **GetAbsPath**\n\n```ts \ngetAbsPath(): String\n```\nReturns the absolute path for the request. \n\n**Example:**\n\n```javascript\nregister((response, request) =\u003e \n{\n    // If the full url is \"http://127.0.0.1/this/is/a/absolute/path?this=is\u0026a=query\u0026string\"\n    // then this will print out \"/this/is/a/absolute/path\"\n    print(\n        request.getAbsPath()\n    );\n\n    return CONTINUE;\n});\n```\n\n#\n\n### **GetMethod**\n\n```ts \ngetMethod(): String\n```\n\nReturns the HTTP method for the current request. Example: GET, POST, etc.\n\n**Example:**\n```javascript\nregister((response, request) =\u003e \n{\n    // Prints out the HTTP method.\n    print(\n        request.getMethod()\n    );\n\n    return CONTINUE;\n});\n```\n#\n\n### **GetLocalAddress**\n\n```ts \ngetLocalAddress(): String\n```\n\nReturns the address of the local interface for the current request. This will return either a IPv4 or IPv6 address.\n\n**Example:**\n```javascript\nregister((response, request) =\u003e \n{\n    // Prints out the local IP address.\n    print(\n        request.getLocalAddress()\n    );\n\n    return CONTINUE;\n});\n```\n\n#\n\n### **GetRemoteAddress**\n\n```ts \ngetRemoteAddress(): String\n```\n\nReturns the address of the remote interface for the current request. This will return either an IPv4 or IPv6 address.\n\u003cbr\u003e*This method can be used to get the connecting client's IP address.*\n\n**Example:**\n```javascript\nregister((response, request) =\u003e \n{\n    // Prints out the remote IP address.\n    print(\n        request.getRemoteAddress()\n    );\n\n    return CONTINUE;\n});\n```\n\n## Response\n\n### **Read**\n\n```ts\nread(asArray?: bool): string | Uint8Array | null\n```\nReads the response body, if the body is empty this will return **null**. This method can only be used in the **SEND_RESPONSE** callback.\n\n\nThe **asArray** parameter specifies whether to return the response body as a Uint8Array, it is optional and\nby default it is set to false. \n\n**Example:**\nPlease understand that this example is not guaranteed to function properly for every underlying application. Every application is different and each application may or may not properly set the response flags. \n\n```javascript\nconst HTTP_SEND_RESPONSE_FLAG_DISCONNECT = 0x00000001;\nconst HTTP_SEND_RESPONSE_FLAG_MORE_DATA = 0x00000002;\nconst HTTP_SEND_RESPONSE_FLAG_BUFFER_DATA = 0x00000004;\nconst HTTP_SEND_RESPONSE_FLAG_ENABLE_NAGLING = 0x00000008;\n\nregister(BEGIN_REQUEST, (response, request) =\u003e \n{ \n    // Write \"test\" to our response body.\n    response.write(\"test\");\n    \n    // Finish here since we only want ourselves modifying the response body.\n    return FINISH;\n});\n\nregister(SEND_RESPONSE, (response, request, flags) =\u003e \n{\n    const data = response.read();\n    \n    ///////////////////////////////\n\n    if (flags \u0026 HTTP_SEND_RESPONSE_FLAG_DISCONNECT)\n        print(\"HTTP_SEND_RESPONSE_FLAG_DISCONNECT\");\n\n    if (flags \u0026 HTTP_SEND_RESPONSE_FLAG_MORE_DATA)\n        print(\"HTTP_SEND_RESPONSE_FLAG_MORE_DATA\");\n\n    if (flags \u0026 HTTP_SEND_RESPONSE_FLAG_BUFFER_DATA)\n        print(\"HTTP_SEND_RESPONSE_FLAG_BUFFER_DATA\");\n        \n    ///////////////////////////////\n\n    print(`SEND_RESPONSE - flag: ${flags} - data: ${data}`);\n    \n    ///////////////////////////////\n    \n    return CONTINUE;\n});\n```\n\n#\n\n### **Write**\n\n```ts\nwrite(\n    body: string | Uint8Array, \n    mimeType?: string, \n    contentEncoding?: string\n): void\n```\n\nWrites to the body of the response.\n\nThe **body** parameter gets written to the response. \u003cbr\u003e\nThe **mimeType** parameter sets the [Content-Type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type) header with the given value; \nthe parameter is also optional and by default is set to \"text/html\".\u003cbr\u003e\nThe **contentEncoding** parameter sets the [Content-Encoding](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding) header so you can provide compressed data through a response. \n\n**Example:**\n\nThe example demonstrates various ways of writing *\"hi\"* as a response:\n```javascript\nregister((response, request) =\u003e \n{\n    // Writes a response with a String.\n    response.write(\"hi\", \"text/html\");\n    \n    // Writes a response with a Uint8Array.\n    response.write(new Uint8Array([0x68, 0x69]), \"text/html\");\n    \n    // Writes a response with a Uint8Array and using the deflate content encoding.\n    response.write(\n        new Uint8Array([0x78, 0x9c, 0xcb, 0xc8, 0x04, 0x00, 0x01, 0x3b, 0x00, 0xd2]), \n        \"text/html\", \n        \"deflate\"\n    );\n    \n    // You have to use FINISH because \n    // we want the request to finish here, and not \n    // continue down the IIS pipeline; otherwise our written\n    // response will be overwritten by other modules like the static file\n    // module.\n    return FINISH;\n});\n```\n#\n\n### **SetHeader**\n\n```ts\nsetHeader(headerName: string, headerValue: string, shouldReplace?: boolean): void\n```\nSets or appends the value of a specified HTTP response header. \n\nThe **headerName** parameter defines the name of the header, example: \"Content-Type.\"\u003cbr\u003e\nThe **headerValue** parameter sets the value of the header, example: \"text/html.\"\u003cbr\u003e\nThe **shouldReplace** parameter determines whether to replace the value of a preexisting header or to append to it. \n\n**Example:**\n\n```javascript\nregister((response, request) =\u003e \n{\n    // This will replace the 'Server' header with the value 'custom server value'\n    response.setHeader('Server', 'custom server value');\n\n    // This will append 'custom server value 2' to the 'Server' header.\n    response.setHeader('Server', 'custom server value 2', false);\n    \n    return CONTINUE;\n});\n```\n\n#\n\n### **GetHeader**\n\n```ts\ngetHeader(headerName: string): string | null\n```\n\nReturns the value of a specified HTTP header. \n\nIf the header doesn't exist this function will return *null* so make sure to check for it.\n\n**Example:**\n\n```javascript\nregister((response, request) =\u003e \n{\n    // Gets the value of the server header.\n    const serverHeaderValue = response.getHeader('Server');\n    \n    // Check if our header exists, in this case, it will.\n    if (serverHeaderValue)\n        // Prints out \"Microsoft-IIS/10.0\" (depending on your server version)\n        print(serverHeaderValue);\n   \n    return CONTINUE;\n});\n```\n\n#\n\n### **DeleteHeader**\n\n```ts\ndeleteHeader(headerName: String): void\n```\n\nDeletes an HTTP header from the request.\n\n**Example:**\n\n```javascript\nregister((response, request) =\u003e \n{\n    response.deleteHeader('Server');\n\n    return CONTINUE;\n});\n```\n\n#\n\n### **Clear**\n\n```ts\nclear(): void\n```\n\nClears the response body. \n\n**Example:**\n```javascript\nregister((response, request) =\u003e \n{\n    response.clear();\n\n    return CONTINUE;\n});\n```\n\n#\n\n### **ClearHeaders**\n\n```ts\nclearHeaders(): void\n```\n\nClears the response headers and sets headers to default values.\n\n**Example:**\n```javascript\nregister((response, request) =\u003e \n{\n    response.clearHeaders();\n\n    return CONTINUE;\n});\n```\n#\n\n### **CloseConnection**\n\n```ts\ncloseConnection(): void\n```\n\nCloses the connection and sends a reset packet to the client.\n\n**Example:**\n```javascript\nregister((response, request) =\u003e \n{\n    response.closeConnection();\n\n    return CONTINUE;\n});\n```\n#\n\n### **SetNeedDisconnect**\n\n```ts\nsetNeedDisconnect(): void\n```\n\nResets the socket after the response is complete.\n\n**Example:**\n```javascript\nregister((response, request) =\u003e \n{\n    response.setNeedDisconnect();\n\n    return CONTINUE;\n});\n```\n#\n\n### **GetKernelCacheEnabled**\n\n```ts\ngetKernelCacheEnabled(): boolean\n```\n\nDetermines whether the kernel cache is enabled for the current response.\n\n**Example:**\n```javascript\nregister((response, request) =\u003e \n{\n    response.getKernelCacheEnabled();\n\n    return CONTINUE;\n});\n```\n#\n\n### **ResetConnection**\n\n```ts\nresetConnection(): void\n```\n\nResets the socket connection immediately.\n\n**Example:**\n```javascript\nregister((response, request) =\u003e \n{\n    response.resetConnection();\n\n    return CONTINUE;\n});\n```\n#\n\n### **GetStatus**\n\n```ts\ngetStatus(): number\n```\n\nRetrieves the HTTP status for the response.\n\n**Example:**\n```javascript\nregister((response, request) =\u003e \n{\n    const status = response.getStatus();\n    \n    return CONTINUE;\n});\n```\n\n#\n\n### **SetStatus**\n\n```ts\nsetStatus(statusCode: Number, statusMessage: string): void\n```\n\nSets the HTTP status for the response.\n\n**Example:**\n```javascript\nregister((response, request) =\u003e \n{\n    response.setStatus(301, \"Moved Permanently\");\n    \n    return FINISH;\n});\n```\n\n#\n\n### **Redirect**\n\n```ts\nredirect(url: string, resetStatusCode: boolean, includeParameters: boolean): boolean\n```\n\nRedirects the client to a specified URL.\n\n**Example:**\n```javascript\nregister((response, request) =\u003e \n{\n    response.redirect(\"/location\", true /* resetStatusCode */, true /* includeParameters */);\n    \n    return CONTINUE;\n});\n```\n\n#\n\n### **SetErrorDescription**\n\n```ts\nsetErrorDescription(decription: string, shouldHtmlEncode: boolean): boolean\n```\n\nSpecifies the custom error description.\n\n**Example:**\n```javascript\nregister((response, request) =\u003e \n{\n    response.setErrorDescription(\"error \u003cb\u003edescription\u003c/b\u003e\", true /* shouldHtmlEncode */);\n    \n    return CONTINUE;\n});\n```\n#\n\n### **DisableBuffering**\n   \n```ts\ndisableBuffering(): void\n```\nDisables response buffering for the current request.\n\n**Example:**\n```javascript\nregister((response, request) =\u003e \n{\n    response.disableBuffering();\n\n    return FINISH;\n});\n```\n\n#\n\n### **DisableKernelCache**\n\n```ts\ndisableKernelCache(reason: number): void\n```\n\nDisables the kernel cache for this response.\n\n**Example:**\n```javascript\nregister((response, request) =\u003e \n{\n    const HANDLER_HTTPSYS_UNFRIENDLY = 9;\n    \n    response.setErrorDescription(HANDLER_HTTPSYS_UNFRIENDLY);\n    \n    return CONTINUE;\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvldr%2Fiismodulejs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvldr%2Fiismodulejs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvldr%2Fiismodulejs/lists"}