1
0

Headers Object to Headers Object

This commit is contained in:
2022-04-27 19:41:02 +02:00
parent 047878aa2c
commit bde596e12b
3 changed files with 17 additions and 23 deletions

6
index.d.ts vendored
View File

@@ -50,7 +50,7 @@ declare class Router {
* @property {string} method HTTP request method
* @property {Object<string, string>} params Object containing all parameters defined in the url string
* @property {Object<string, string>} query Object containing all query parameters
* @property {Object<string, string>} headers Object containing request headers
* @property {Headers} headers Request headers object
* @property {Object<string, string> | string} body Only available if method is `POST`, `PUT`, `PATCH` or `DELETE`. Contains either the received body string or a parsed object if valid JSON was sent.
* @property {Object<string, string | number>} cf object containing custom Cloudflare properties. (https://developers.cloudflare.com/workers/examples/accessing-the-cloudflare-object)
*/
@@ -58,7 +58,7 @@ declare class Router {
* Response Object
*
* @typedef RouterResponse
* @property {Object<string, string>} headers Object you can set response headers in
* @property {Headers} headers Response headers object
* @property {number} status Return status code (default: `204`)
* @property {Object<string, string> | string} body Either an `object` (will be converted to JSON) or a string
* @property {Response} raw A response object that is to be returned, this will void all other res properties and return this as is.
@@ -306,7 +306,7 @@ type RouterResponse = {
/**
* Object you can set response headers in
*/
headers: Object<string, string>
headers: Headers
/**
* Return status code (default: `204`)
*/