Added content type to SetRequest struct
This commit is contained in:
parent
4d3e4ebee5
commit
ecfbbd58ad
|
@ -225,6 +225,12 @@ func (r *StateStore) writeFile(req *state.SetRequest) error {
|
||||||
blobURL := r.containerURL.NewBlockBlobURL(getFileName(req.Key))
|
blobURL := r.containerURL.NewBlockBlobURL(getFileName(req.Key))
|
||||||
|
|
||||||
var blobHTTPHeaders azblob.BlobHTTPHeaders
|
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 != "" {
|
if val, ok := req.Metadata[contentType]; ok && val != "" {
|
||||||
blobHTTPHeaders.ContentType = val
|
blobHTTPHeaders.ContentType = val
|
||||||
delete(req.Metadata, contentType)
|
delete(req.Metadata, contentType)
|
||||||
|
|
|
@ -43,11 +43,12 @@ type DeleteStateOption struct {
|
||||||
|
|
||||||
// SetRequest is the object describing an upsert request
|
// SetRequest is the object describing an upsert request
|
||||||
type SetRequest struct {
|
type SetRequest struct {
|
||||||
Key string `json:"key"`
|
Key string `json:"key"`
|
||||||
Value interface{} `json:"value"`
|
Value interface{} `json:"value"`
|
||||||
ETag *string `json:"etag,omitempty"`
|
ETag *string `json:"etag,omitempty"`
|
||||||
Metadata map[string]string `json:"metadata,omitempty"`
|
Metadata map[string]string `json:"metadata,omitempty"`
|
||||||
Options SetStateOption `json:"options,omitempty"`
|
Options SetStateOption `json:"options,omitempty"`
|
||||||
|
ContentType string `json:"contentType,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetKey gets the Key on a SetRequest
|
// GetKey gets the Key on a SetRequest
|
||||||
|
|
|
@ -7,9 +7,10 @@ package state
|
||||||
|
|
||||||
// GetResponse is the request object for getting state
|
// GetResponse is the request object for getting state
|
||||||
type GetResponse struct {
|
type GetResponse struct {
|
||||||
Data []byte `json:"data"`
|
Data []byte `json:"data"`
|
||||||
ETag *string `json:"etag,omitempty"`
|
ETag *string `json:"etag,omitempty"`
|
||||||
Metadata map[string]string `json:"metadata"`
|
Metadata map[string]string `json:"metadata"`
|
||||||
|
ContentType string `json:"contentType,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// BulkGetResponse is the response object for bulk get response.
|
// BulkGetResponse is the response object for bulk get response.
|
||||||
|
|
Loading…
Reference in New Issue