File tree Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -45,17 +45,19 @@ private static void HandleTest(IApplicationBuilder app)
45
45
{
46
46
app . Run ( async ctx =>
47
47
{
48
- var rsp = await _http . GetAsync ( "/data" ) ;
49
- var str = await rsp . Content . ReadAsStringAsync ( ) ;
48
+ using ( var rsp = await _http . GetAsync ( "/data" ) )
49
+ {
50
+ var str = await rsp . Content . ReadAsStringAsync ( ) ;
50
51
51
- // deserialize
52
- var obj = JsonConvert . DeserializeObject < Response > ( str ) ;
52
+ // deserialize
53
+ var obj = JsonConvert . DeserializeObject < Response > ( str ) ;
53
54
54
- // serialize
55
- var json = JsonConvert . SerializeObject ( obj ) ;
56
-
57
- ctx . Response . ContentType = "application/json" ;
58
- await ctx . Response . WriteAsync ( json ) ;
55
+ // serialize
56
+ var json = JsonConvert . SerializeObject ( obj ) ;
57
+
58
+ ctx . Response . ContentType = "application/json" ;
59
+ await ctx . Response . WriteAsync ( json ) ;
60
+ }
59
61
} ) ;
60
62
}
61
63
You can’t perform that action at this time.
0 commit comments