@@ -255,6 +255,41 @@ fn test_request() {
255
255
{\" Content-Type\" :\" text/plain\" },\" env\" :\
256
256
{\" PATH_INFO\" :\" /bar\" }}}"
257
257
) ;
258
+
259
+ let event = v7:: Event {
260
+ request : Some ( v7:: Request {
261
+ url : "https://www.example.invalid/bar" . parse ( ) . ok ( ) ,
262
+ method : Some ( "GET" . into ( ) ) ,
263
+ data : Some ( "{}" . into ( ) ) ,
264
+ query_string : Some ( "foo=bar&blub=blah" . into ( ) ) ,
265
+ cookies : Some ( "dummy=42" . into ( ) ) ,
266
+ other : {
267
+ let mut m = HashMap :: new ( ) ;
268
+ m. insert ( "other_key" . into ( ) , "other_value" . into ( ) ) ;
269
+ m
270
+ } ,
271
+ ..Default :: default ( )
272
+ } ) ,
273
+ ..Default :: default ( )
274
+ } ;
275
+
276
+ assert_eq ! (
277
+ serde_json:: to_string( & event) . unwrap( ) ,
278
+ "{\" request\" :{\" url\" :\" https://www.example.invalid/bar\" ,\
279
+ \" method\" :\" GET\" ,\" data\" :\" {}\" ,\" query_string\" :\
280
+ \" foo=bar&blub=blah\" ,\" cookies\" :\" dummy=42\" ,\
281
+ \" other_key\" :\" other_value\" }}"
282
+ ) ;
283
+
284
+ let event = v7:: Event {
285
+ request : Some ( Default :: default ( ) ) ,
286
+ ..Default :: default ( )
287
+ } ;
288
+
289
+ assert_eq ! (
290
+ serde_json:: to_string( & event) . unwrap( ) ,
291
+ "{\" request\" :{}}"
292
+ ) ;
258
293
}
259
294
260
295
#[ test]
0 commit comments