Skip to content

Commit 3dadc0b

Browse files
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>
1 parent a0ee8d1 commit 3dadc0b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

sdk/src/main/java/io/dapr/client/AbstractDaprClient.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,11 @@ public Mono<Void> saveState(String storeName, String key, Object value) {
493493
*/
494494
@Override
495495
public Mono<Void> saveState(String storeName, String key, String etag, Object value, StateOptions options) {
496-
State<?> state = new State<>(key, value, etag, options);
496+
Map<String, String> meta = null;
497+
if (value != null) {
498+
meta = Collections.singletonMap("contentType", stateSerializer.getContentType());
499+
}
500+
State<?> state = new State<>(key, value, etag, meta, options);
497501
return this.saveBulkState(storeName, Collections.singletonList(state));
498502
}
499503

0 commit comments

Comments
 (0)