Skip to content

Commit

Permalink
feat(cachecontrol): add second target argument to cacheControl
Browse files Browse the repository at this point in the history
Add second `target` argument to cacheControl for backwards compatibility.

Fix #5192
  • Loading branch information
maiieul committed Sep 27, 2023
1 parent fdc2557 commit b08d8b5
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@
}
],
"kind": "Interface",
"content": "```typescript\nexport interface RequestEventBase<PLATFORM = QwikCityPlatform> \n```\n\n\n| Property | Modifiers | Type | Description |\n| --- | --- | --- | --- |\n| [basePathname](#) | <code>readonly</code> | string | The base pathname of the request, which can be configured at build time. Defaults to <code>/</code>. |\n| [cacheControl](#) | <code>readonly</code> | (cacheControl: [CacheControl](#cachecontrol)<!-- -->) =&gt; void | <p>Convenience method to set the Cache-Control header.</p><p>https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control</p> |\n| [clientConn](#) | <code>readonly</code> | [ClientConn](#clientconn) | Provides information about the client connection, such as the IP address and the country the request originated from. |\n| [cookie](#) | <code>readonly</code> | [Cookie](#cookie) | <p>HTTP request and response cookie. Use the <code>get()</code> method to retrieve a request cookie value. Use the <code>set()</code> method to set a response cookie value.</p><p>https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies</p> |\n| [env](#) | <code>readonly</code> | [EnvGetter](#envgetter) | Platform provided environment variables. |\n| [headers](#) | <code>readonly</code> | Headers | <p>HTTP response headers. Notice it will be empty until you first add a header. If you want to read the request headers, use <code>request.headers</code> instead.</p><p>https://developer.mozilla.org/en-US/docs/Glossary/Response\\_header</p> |\n| [method](#) | <code>readonly</code> | string | <p>HTTP request method.</p><p>https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods</p> |\n| [params](#) | <code>readonly</code> | Readonly&lt;Record&lt;string, string&gt;&gt; | URL path params which have been parsed from the current url pathname segments. Use <code>query</code> to instead retrieve the query string search params. |\n| [parseBody](#) | <code>readonly</code> | () =&gt; Promise&lt;unknown&gt; | <p>This method will check the request headers for a <code>Content-Type</code> header and parse the body accordingly. It supports <code>application/json</code>, <code>application/x-www-form-urlencoded</code>, and <code>multipart/form-data</code> content types.</p><p>If the <code>Content-Type</code> header is not set, it will return <code>null</code>.</p> |\n| [pathname](#) | <code>readonly</code> | string | <p>URL pathname. Does not include the protocol, domain, query string (search params) or hash.</p><p>https://developer.mozilla.org/en-US/docs/Web/API/URL/pathname</p> |\n| [platform](#) | <code>readonly</code> | PLATFORM | Platform specific data and functions |\n| [query](#) | <code>readonly</code> | URLSearchParams | <p>URL Query Strings (URL Search Params). Use <code>params</code> to instead retrieve the route params found in the url pathname.</p><p>https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams</p> |\n| [request](#) | <code>readonly</code> | Request | HTTP request information. |\n| [sharedMap](#) | <code>readonly</code> | Map&lt;string, any&gt; | Shared Map across all the request handlers. Every HTTP request will get a new instance of the shared map. The shared map is useful for sharing data between request handlers. |\n| [signal](#) | <code>readonly</code> | AbortSignal | Request's AbortSignal (same as <code>request.signal</code>). This signal indicates that the request has been aborted. |\n| [url](#) | <code>readonly</code> | URL | HTTP request URL. |",
"content": "```typescript\nexport interface RequestEventBase<PLATFORM = QwikCityPlatform> \n```\n\n\n| Property | Modifiers | Type | Description |\n| --- | --- | --- | --- |\n| [basePathname](#) | <code>readonly</code> | string | The base pathname of the request, which can be configured at build time. Defaults to <code>/</code>. |\n| [cacheControl](#) | <code>readonly</code> | (cacheControl: [CacheControl](#cachecontrol)<!-- -->, target?: CacheControlTarget) =&gt; void | <p>Convenience method to set the Cache-Control header. Depending on your CDN, you may want to add another cacheControl with the second argument set to <code>CDN-Cache-Control</code> or any other value (we provide the most common values for auto-complete, but you can use any string you want).</p><p>See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control and https://qwik.builder.io/docs/caching/\\#CDN-Cache-Controls for more information.</p> |\n| [clientConn](#) | <code>readonly</code> | [ClientConn](#clientconn) | Provides information about the client connection, such as the IP address and the country the request originated from. |\n| [cookie](#) | <code>readonly</code> | [Cookie](#cookie) | <p>HTTP request and response cookie. Use the <code>get()</code> method to retrieve a request cookie value. Use the <code>set()</code> method to set a response cookie value.</p><p>https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies</p> |\n| [env](#) | <code>readonly</code> | [EnvGetter](#envgetter) | Platform provided environment variables. |\n| [headers](#) | <code>readonly</code> | Headers | <p>HTTP response headers. Notice it will be empty until you first add a header. If you want to read the request headers, use <code>request.headers</code> instead.</p><p>https://developer.mozilla.org/en-US/docs/Glossary/Response\\_header</p> |\n| [method](#) | <code>readonly</code> | string | <p>HTTP request method.</p><p>https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods</p> |\n| [params](#) | <code>readonly</code> | Readonly&lt;Record&lt;string, string&gt;&gt; | URL path params which have been parsed from the current url pathname segments. Use <code>query</code> to instead retrieve the query string search params. |\n| [parseBody](#) | <code>readonly</code> | () =&gt; Promise&lt;unknown&gt; | <p>This method will check the request headers for a <code>Content-Type</code> header and parse the body accordingly. It supports <code>application/json</code>, <code>application/x-www-form-urlencoded</code>, and <code>multipart/form-data</code> content types.</p><p>If the <code>Content-Type</code> header is not set, it will return <code>null</code>.</p> |\n| [pathname](#) | <code>readonly</code> | string | <p>URL pathname. Does not include the protocol, domain, query string (search params) or hash.</p><p>https://developer.mozilla.org/en-US/docs/Web/API/URL/pathname</p> |\n| [platform](#) | <code>readonly</code> | PLATFORM | Platform specific data and functions |\n| [query](#) | <code>readonly</code> | URLSearchParams | <p>URL Query Strings (URL Search Params). Use <code>params</code> to instead retrieve the route params found in the url pathname.</p><p>https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams</p> |\n| [request](#) | <code>readonly</code> | Request | HTTP request information. |\n| [sharedMap](#) | <code>readonly</code> | Map&lt;string, any&gt; | Shared Map across all the request handlers. Every HTTP request will get a new instance of the shared map. The shared map is useful for sharing data between request handlers. |\n| [signal](#) | <code>readonly</code> | AbortSignal | Request's AbortSignal (same as <code>request.signal</code>). This signal indicates that the request has been aborted. |\n| [url](#) | <code>readonly</code> | URL | HTTP request URL. |",
"editUrl": "https://github.com/BuilderIO/qwik/tree/main/packages/qwik-city/middleware/request-handler/types.ts",
"mdFile": "qwik-city.requesteventbase.md"
},
Expand Down
Loading

0 comments on commit b08d8b5

Please sign in to comment.