Skip to content

Commit

Permalink
Clean up typings, implement suggestion from @glasser
Browse files Browse the repository at this point in the history
  • Loading branch information
trevor-scheer committed Dec 9, 2022
1 parent 0730c75 commit 6817d22
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/RESTDataSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,15 +173,16 @@ export abstract class RESTDataSource {
*/
protected requestDeduplicationPolicyFor(
url: URL,
request: WithRequired<RequestOptions, 'method'>,
request: RequestOptions,
): RequestDeduplicationPolicy {
const method = request.method ?? 'GET';
// Start with the cache key that is used for the shared header-sensitive
// cache. Note that its default implementation does not include the HTTP
// method, so if a subclass overrides this and allows non-GET/HEADs to be
// de-duplicated it will be important for it to include (at least!) the
// method in the deduplication key, so we're explicitly adding GET/HEAD here.
const cacheKey = this.cacheKeyFor(url, request);
if (['GET', 'HEAD'].includes(request.method)) {
if (['GET', 'HEAD'].includes(method)) {
return {
policy: 'deduplicate-during-request-lifetime',
deduplicationKey: cacheKey,
Expand Down

0 comments on commit 6817d22

Please sign in to comment.