@@ -199,9 +199,14 @@ def datum_as_proto(datum: Datum) -> protos.TypedData:
199
199
enable_content_negotiation = False ,
200
200
body = datum_as_proto (datum .value ['body' ]),
201
201
))
202
+ elif datum .type is None :
203
+ return None
202
204
elif datum .type == 'dict' :
203
205
# TypedData doesn't support dict, so we return it as json
204
206
return protos .TypedData (json = json .dumps (datum .value ))
207
+ elif datum .type == 'list' :
208
+ # TypedData doesn't support list, so we return it as json
209
+ return protos .TypedData (json = json .dumps (datum .value ))
205
210
elif datum .type == 'http_response' :
206
211
return protos .TypedData (http = protos .RpcHttp (
207
212
status_code = str (datum .value .status_code ),
@@ -211,10 +216,9 @@ def datum_as_proto(datum: Datum) -> protos.TypedData:
211
216
},
212
217
cookies = parse_to_rpc_http_cookie_list (None ),
213
218
enable_content_negotiation = False ,
214
- body = datum_as_proto (Datum (type = "string" , value = datum .value .get_body ())),
219
+ body = datum_as_proto (Datum (type = "string" ,
220
+ value = datum .value .get_body ())),
215
221
))
216
- elif datum .type is None :
217
- return None
218
222
else :
219
223
raise NotImplementedError (
220
224
'unexpected Datum type: {!r}' .format (datum .type )
0 commit comments