Skip to content

Commit

Permalink
Use default state serializer content type if state is not null (#1033)
Browse files Browse the repository at this point in the history
Signed-off-by: Antonio Sanchez <antonio.maria.sanchez@gmail.com>
Co-authored-by: Cassie Coyle <cassie@diagrid.io>
  • Loading branch information
antoniomaria and cicoyle authored Jul 3, 2024
1 parent a0ee8d1 commit 3dadc0b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion sdk/src/main/java/io/dapr/client/AbstractDaprClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,11 @@ public Mono<Void> saveState(String storeName, String key, Object value) {
*/
@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));
}

Expand Down

0 comments on commit 3dadc0b

Please sign in to comment.