Skip to content

Commit

Permalink
Fix CachePolicy typing
Browse files Browse the repository at this point in the history
  • Loading branch information
martijnwalraven committed Jul 17, 2018
1 parent 4aa21b7 commit ce38b63
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/apollo-datasource-rest/src/HTTPCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class HTTPCache {

const policy = CachePolicy.fromObject(policyRaw);
// Remove url from the policy, because otherwise it would never match a request with a custom cache key
(policy as any)._url = undefined;
policy._url = undefined;

if (policy.satisfiesWithoutRevalidation(policyRequestFrom(request))) {
const headers = policy.responseHeaders();
Expand Down Expand Up @@ -96,7 +96,7 @@ export class HTTPCache {
let ttl = cacheOptions && cacheOptions.ttl;

if (ttl) {
(policy as any)._rescc['max-age'] = ttl;
policy._rescc['max-age'] = ttl;
}

if (!policy.storable()) return response;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ declare module 'http-cache-semantics' {
static fromObject(object: object): CachePolicy;
toObject(): object;

_url: string;
_url: string | undefined;
_status: number;
_rescc: { [key: string]: any };
}

export = CachePolicy;
Expand Down

0 comments on commit ce38b63

Please sign in to comment.