beetlex-io / FastHttpApi

a lightweight and high-performance http/websocket service component in the dotnet core platform that supports TLS.
Apache License 2.0
650 stars 175 forks source link

我自定义了DataConvertAttribute 但并没有走。还是走的jsonDataConvert #189

Closed nodyang closed 1 year ago

nodyang commented 1 year ago

public class XmlYDataConvertAttribute : DataConvertAttribute { public override void Execute(IDataContext dataContext, HttpRequest request) { if (request.Length > 0) { using (request.Stream.LockFree()) { string value = ""; using (System.IO.StreamReader streamReader = new System.IO.StreamReader(request.Stream)) { value = streamReader.ReadToEnd(); if (!string.IsNullOrEmpty(value)) { dataContext.SetValue("ywXml", value); } } } } } }