Skip to content

Commit c55807d

Browse files
committed
Serialize ttl_status_map as object
1 parent 053e1f8 commit c55807d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

worker/src/request_init.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use crate::headers::Headers;
44
use crate::http::Method;
55

66
use js_sys::{self, Object};
7+
use serde::Serialize;
78
use wasm_bindgen::{prelude::*, JsValue};
89

910
/// Optional options struct that contains settings to apply to the `Request`.
@@ -146,6 +147,7 @@ impl From<&CfProperties> for JsValue {
146147
fn from(props: &CfProperties) -> Self {
147148
let obj = js_sys::Object::new();
148149
let defaults = CfProperties::default();
150+
let serializer = serde_wasm_bindgen::Serializer::new().serialize_maps_as_objects(true);
149151

150152
set_prop(
151153
&obj,
@@ -191,7 +193,7 @@ impl From<&CfProperties> for JsValue {
191193
set_prop(
192194
&obj,
193195
&JsValue::from("cacheTtlByStatus"),
194-
&serde_wasm_bindgen::to_value(&ttl_status_map).unwrap_or_default(),
196+
&ttl_status_map.serialize(&serializer).unwrap_or_default(),
195197
);
196198

197199
set_prop(

0 commit comments

Comments
 (0)