From 996910a2cd7d61d01d3973504ae2eef23b82ed2e Mon Sep 17 00:00:00 2001 From: "nodyang@aliyun.com" Date: Fri, 27 Sep 2024 10:21:55 +0800 Subject: [PATCH] =?UTF-8?q?Test=20=E6=B7=BB=E5=8A=A0test=20=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SlnMesnac.TouchSocket/ApiServer.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/SlnMesnac.TouchSocket/ApiServer.cs b/SlnMesnac.TouchSocket/ApiServer.cs index 1d4f4f9..7ffbcf7 100644 --- a/SlnMesnac.TouchSocket/ApiServer.cs +++ b/SlnMesnac.TouchSocket/ApiServer.cs @@ -2,12 +2,14 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using Microsoft.AspNetCore.Http.Features; using Microsoft.Extensions.Logging; using SlnMesnac.Model.domain; using SlnMesnac.Repository.service; using SlnMesnac.Repository.service.LogImpl; using SlnMesnac.Repository.service.ScanLog; using TouchSocket.Core; +using TouchSocket.Http; using TouchSocket.Rpc; using TouchSocket.WebApi; @@ -37,6 +39,22 @@ namespace SlnMesnac.TouchSocket + + [EnableCors("cors")] + [WebApi(HttpMethodType.POST)] + + public string Test(IWebApiCallContext callContext) + { + //http内容 + var httpContext = callContext.HttpContext; + + //http请求 + var request = httpContext.Request; + + var str = request.GetBody(); + return str; + } + [EnableCors("cors")] [WebApi(HttpMethodType.POST)]