File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99 NotFoundError ,
1010 ValidationError ,
1111} from '@speakeasy-services/common' ;
12+ import { CACHE_IMMUTABLE_PRIVATE } from '@speakeasy-services/service-base' ;
1213
1314type Response = Parameters < RequestHandler > [ 1 ] ;
1415import {
@@ -125,6 +126,7 @@ const methodHandlers = {
125126
126127 const stream = await getFromS3 ( key ) ;
127128 res . setHeader ( 'Content-Type' , record . mimeType ) ;
129+ res . setHeader ( 'Cache-Control' , CACHE_IMMUTABLE_PRIVATE ) ;
128130 res . status ( 200 ) ;
129131 await pipeline ( stream , res ) ;
130132
Original file line number Diff line number Diff line change 99 ValidationError ,
1010 validateAgainstLexicon ,
1111} from '@speakeasy-services/common' ;
12+ import { CACHE_SHORT_PUBLIC } from '@speakeasy-services/service-base' ;
1213import {
1314 checkContributionDef ,
1415 createTestimonialDef ,
@@ -190,12 +191,16 @@ const methodHandlers = {
190191} as const ;
191192
192193// Define methods using XRPC lexicon
193- export const methods : Record < MethodName , { handler : RequestHandler } > = {
194+ export const methods : Record <
195+ MethodName ,
196+ { handler : RequestHandler ; cacheControl ?: string }
197+ > = {
194198 'social.spkeasy.actor.createTestimonial' : {
195199 handler : methodHandlers [ 'social.spkeasy.actor.createTestimonial' ] ,
196200 } ,
197201 'social.spkeasy.actor.listTestimonials' : {
198202 handler : methodHandlers [ 'social.spkeasy.actor.listTestimonials' ] ,
203+ cacheControl : CACHE_SHORT_PUBLIC ,
199204 } ,
200205 'social.spkeasy.actor.updateTestimonial' : {
201206 handler : methodHandlers [ 'social.spkeasy.actor.updateTestimonial' ] ,
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import {
1414 User ,
1515 getSessionDid ,
1616} from '@speakeasy-services/common' ;
17+ import { CACHE_SHORT_PRIVATE } from '@speakeasy-services/service-base' ;
1718import {
1819 getPublicKeyDef ,
1920 getPrivateKeysDef ,
@@ -153,12 +154,17 @@ const methodHandlers = {
153154
154155type MethodName = keyof typeof methodHandlers ;
155156
156- export const methods : Record < MethodName , { handler : RequestHandler } > = {
157+ export const methods : Record <
158+ MethodName ,
159+ { handler : RequestHandler ; cacheControl ?: string }
160+ > = {
157161 'social.spkeasy.key.getPublicKey' : {
158162 handler : methodHandlers [ 'social.spkeasy.key.getPublicKey' ] ,
163+ cacheControl : CACHE_SHORT_PRIVATE ,
159164 } ,
160165 'social.spkeasy.key.getPublicKeys' : {
161166 handler : methodHandlers [ 'social.spkeasy.key.getPublicKeys' ] ,
167+ cacheControl : CACHE_SHORT_PRIVATE ,
162168 } ,
163169 'social.spkeasy.key.getPrivateKey' : {
164170 handler : methodHandlers [ 'social.spkeasy.key.getPrivateKey' ] ,
You can’t perform that action at this time.
0 commit comments