File tree Expand file tree Collapse file tree 1 file changed +6
-9
lines changed
WebApiClientCore/Attributes/ParameterAttributes Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -33,22 +33,19 @@ public string CharSet
3333 /// <returns></returns>
3434 protected override Task SetHttpContentAsync ( ApiParameterContext context )
3535 {
36+ var jsonContent = new JsonContent ( ) ;
37+ context . HttpContext . RequestMessage . Content = jsonContent ;
38+ jsonContent . Headers . ContentType . CharSet = this . encoding . WebName ;
39+
3640 if ( Encoding . UTF8 . Equals ( this . encoding ) == true )
3741 {
38- var jsonContent = new JsonContent ( ) ;
39- context . HttpContext . RequestMessage . Content = jsonContent ;
4042 context . SerializeToJson ( jsonContent ) ;
4143 }
4244 else
4345 {
44- var jsonContent = new JsonContent ( ) ;
45- jsonContent . Headers . ContentType . CharSet = this . encoding . WebName ;
46- context . HttpContext . RequestMessage . Content = jsonContent ;
47-
48- var buffer = context . SerializeToJson ( this . encoding ) ;
49- jsonContent . Write ( buffer ) ;
46+ var json = context . SerializeToJson ( this . encoding ) ;
47+ jsonContent . Write ( json ) ;
5048 }
51-
5249 return Task . CompletedTask ;
5350 }
5451 }
You can’t perform that action at this time.
0 commit comments