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))
|
||||
|
||||
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)
|
||||
|
|
|
@ -43,11 +43,12 @@ type DeleteStateOption struct {
|
|||
|
||||
// SetRequest is the object describing an upsert request
|
||||
type SetRequest struct {
|
||||
Key string `json:"key"`
|
||||
Value interface{} `json:"value"`
|
||||
ETag *string `json:"etag,omitempty"`
|
||||
Metadata map[string]string `json:"metadata,omitempty"`
|
||||
Options SetStateOption `json:"options,omitempty"`
|
||||
Key string `json:"key"`
|
||||
Value interface{} `json:"value"`
|
||||
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
|
||||
|
|
|
@ -7,9 +7,10 @@ package state
|
|||
|
||||
// GetResponse is the request object for getting state
|
||||
type GetResponse struct {
|
||||
Data []byte `json:"data"`
|
||||
ETag *string `json:"etag,omitempty"`
|
||||
Metadata map[string]string `json:"metadata"`
|
||||
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.
|
||||
|
|
Loading…
Reference in New Issue