Added content type to SetRequest struct

This commit is contained in:
jigargandhi 2021-09-14 18:26:36 +05:30
parent 4d3e4ebee5
commit ecfbbd58ad
3 changed files with 16 additions and 8 deletions

View File

@ -225,6 +225,12 @@ func (r *StateStore) writeFile(req *state.SetRequest) error {
blobURL := r.containerURL.NewBlockBlobURL(getFileName(req.Key))
var blobHTTPHeaders azblob.BlobHTTPHeaders
if req.ContentType != nil && req.ContentType != "" {
blobHTTPHeaders.ContentType = req.ContentType
}
// this is for backward compatibility where it might have come from http request
if val, ok := req.Metadata[contentType]; ok && val != "" {
blobHTTPHeaders.ContentType = val
delete(req.Metadata, contentType)

View File

@ -48,6 +48,7 @@ type SetRequest struct {
ETag *string `json:"etag,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
Options SetStateOption `json:"options,omitempty"`
ContentType string `json:"contentType,omitempty"`
}
// GetKey gets the Key on a SetRequest

View File

@ -10,6 +10,7 @@ type GetResponse struct {
Data []byte `json:"data"`
ETag *string `json:"etag,omitempty"`
Metadata map[string]string `json:"metadata"`
ContentType string `json:"contentType,omitempty"`
}
// BulkGetResponse is the response object for bulk get response.