refactor 优化代码
This commit is contained in:
22
Src/Dlhis.Basic.Api/ContentHandlers/CodeContentHandler.cs
Normal file
22
Src/Dlhis.Basic.Api/ContentHandlers/CodeContentHandler.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System.Text;
|
||||
using Kurisu.RemoteCall;
|
||||
using Kurisu.RemoteCall.Abstractions;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Dlhis.Basic.Api.ContentHandlers;
|
||||
|
||||
public class CodeContentHandler : IContentHandler
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public HttpContent Create(List<ParameterValue> values)
|
||||
{
|
||||
var code = values.First(x => x.Parameter.Name == "code").GetValue<string>();
|
||||
var obj = new
|
||||
{
|
||||
code,
|
||||
};
|
||||
var json = JsonConvert.SerializeObject(obj);
|
||||
|
||||
return new StringContent(json, Encoding.UTF8, "application/json");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user