implemented If-None-Match header on file get
This commit is contained in:
parent
23c67e0b81
commit
600547342a
@ -71,6 +71,12 @@ func initHttp(schema graphql.Schema, s3Client *minio.Client, loaderMap map[strin
|
||||
return
|
||||
}
|
||||
|
||||
reqEtag := r.Header.Get("If-None-Match")
|
||||
if reqEtag == objInfo.ETag {
|
||||
rw.WriteHeader(304)
|
||||
return
|
||||
}
|
||||
|
||||
obj, err := s3Client.GetObject(context.Background(), bucketName, id, minio.GetObjectOptions{})
|
||||
|
||||
if err != nil {
|
||||
@ -78,7 +84,7 @@ func initHttp(schema graphql.Schema, s3Client *minio.Client, loaderMap map[strin
|
||||
return
|
||||
}
|
||||
|
||||
rw.Header().Set("Cache-Control", "no-store")
|
||||
rw.Header().Set("Cache-Control", "must-revalidate")
|
||||
rw.Header().Set("Content-Disposition", fmt.Sprintf("attachment; filename=\"%s\"", filepath.Base((objInfo.Key))))
|
||||
rw.Header().Set("Content-Type", objInfo.ContentType)
|
||||
rw.Header().Set("ETag", objInfo.ETag)
|
||||
|
Loading…
Reference in New Issue
Block a user