1+ import { Obj } from '@storage/schemas'
12import { HeadRenderer } from './head'
2- import { FastifyRequest } from 'fastify'
3+ import { FastifyRequest , FastifyReply } from 'fastify'
34import { AssetResponse , RenderOptions } from './renderer'
4- import { Obj } from '@storage/schemas'
5- import { FastifyReply } from 'fastify/types/reply'
65
76/**
87 * HeadRenderer
@@ -16,7 +15,18 @@ export class InfoRenderer extends HeadRenderer {
1615
1716 return {
1817 ...headAsset ,
19- body : obj ,
18+ body : {
19+ id : obj . id ,
20+ name : obj . name ,
21+ version : obj . version ,
22+ size : obj . metadata ?. size ?? null ,
23+ content_type : obj . metadata ?. mimetype ?? null ,
24+ cache_control : obj . metadata ?. cacheControl ?? null ,
25+ etag : obj . metadata ?. eTag ?? null ,
26+ metadata : obj . user_metadata ,
27+ last_modified : obj . metadata ?. lastModified ?? null ,
28+ created_at : obj . created_at ,
29+ } ,
2030 }
2131 }
2232
@@ -26,6 +36,12 @@ export class InfoRenderer extends HeadRenderer {
2636 data : AssetResponse ,
2737 options : RenderOptions
2838 ) {
29- // no-op
39+ response
40+ . status ( data . metadata . httpStatusCode ?? 200 )
41+ . header ( 'Content-Type' , 'application/json' )
42+ . header ( 'ETag' , data . metadata . eTag )
43+ . header ( 'Content-Length' , data . metadata . contentLength )
44+ . header ( 'Last-Modified' , data . metadata . lastModified ?. toUTCString ( ) )
45+ . header ( 'CacheControl' , data . metadata . cacheControl )
3046 }
3147}
0 commit comments