Use default state serializer content type if state is not null (#1033)

Signed-off-by: Antonio Sanchez <antonio.maria.sanchez@gmail.com>
Co-authored-by: Cassie Coyle <cassie@diagrid.io>
This commit is contained in:
Antonio Maria Sanchez Berrocal 2024-07-03 17:42:38 +03:00 committed by GitHub
parent a0ee8d1199
commit 3dadc0be06
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 1 deletions

View File

@ -493,7 +493,11 @@ abstract class AbstractDaprClient implements DaprClient, DaprPreviewClient {
*/
@Override
public Mono<Void> saveState(String storeName, String key, String etag, Object value, StateOptions options) {
State<?> state = new State<>(key, value, etag, options);
Map<String, String> meta = null;
if (value != null) {
meta = Collections.singletonMap("contentType", stateSerializer.getContentType());
}
State<?> state = new State<>(key, value, etag, meta, options);
return this.saveBulkState(storeName, Collections.singletonList(state));
}