Skip to content

Commit

Permalink
test: cache-control
Browse files Browse the repository at this point in the history
  • Loading branch information
CachedaCodes committed Nov 13, 2023
1 parent 40c8148 commit 3f20aed
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 34 deletions.
1 change: 0 additions & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="x-archetype">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<link rel="icon" href="./favicon.ico" />
Expand Down
67 changes: 34 additions & 33 deletions src/adapter/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,39 +15,7 @@ import {
SemanticQueriesRequest
} from '@empathyco/x-types';

export const adapter = {
...platformAdapter,
search: {
...platformAdapter.search,
defaultRequestOptions: {
...(platformAdapter.search as any).defaultRequestOptions,
properties: {
...(platformAdapter.search as any).defaultRequestOptions.properties,
cache: 'force-cache'
}
}
},
relatedTags: {
...platformAdapter.relatedTags,
defaultRequestOptions: {
...(platformAdapter.relatedTags as any).defaultRequestOptions,
properties: {
...(platformAdapter.relatedTags as any).defaultRequestOptions.properties,
cache: 'force-cache'
}
}
},
nextQueries: {
...platformAdapter.nextQueries,
defaultRequestOptions: {
...(platformAdapter.nextQueries as any).defaultRequestOptions,
properties: {
...(platformAdapter.nextQueries as any).defaultRequestOptions.properties,
cache: 'force-cache'
}
}
}
};
export const adapter = platformAdapter;

/* Code sample about how to extend the result mapper with more fields. */

Expand All @@ -65,6 +33,39 @@ declare module '@empathyco/x-types' {
}
}

adapter.search = platformAdapter.search.extends<any, any>({
defaultRequestOptions: {
properties: {
headers: {
'cache-control': 'max-age=100'
},
cache: 'no-cache'
}
}
});

adapter.relatedTags = platformAdapter.relatedTags.extends<any, any>({
defaultRequestOptions: {
properties: {
headers: {
'cache-control': 'max-age=100'
},
cache: 'no-cache'
}
}
});

adapter.nextQueries = platformAdapter.nextQueries.extends<any, any>({
defaultRequestOptions: {
properties: {
headers: {
'cache-control': 'max-age=100'
},
cache: 'no-cache'
}
}
});

resultSchema.$override<EmpathyDemoPlatformResult, Partial<Result>>({
description: 'description',
collection: 'collection',
Expand Down

0 comments on commit 3f20aed

Please sign in to comment.