我有一个第三方向我的API发布请求...他们将加密文本作为正文发布,但还包括application / json作为内容类型。我有什么方法可以让.Net Core 2.2来处理此问题...我已经尝试过...
[HttpPost("/callback/thirdparty")]
[AllowAnonymous]
public IActionResult Thirdparty([FromBody]dynamic body)
{
和
[HttpPost("/callback/thirdparty")]
[AllowAnonymous]
public IActionResult Thirdparty([FromBody]string body)
{
但都不行。
Request Headers
Content-Type: "application/json"
Accept: "*/*"
Cache-Control: "no-cache"
Accept-Encoding: "gzip, deflate"
Content-Length: 155
Connection: "keep-alive"
Request Body
z42T\/+j28AyZRslEXIZx9Vt87D1HOdMZqukzIi7s4gbtZqtdJJjJtQMkZ+O9vG3VlfJZ+6Ro7vwE\n6nTSwqczc2SwPiAaRjgv7nauvR2E3d8tk8zbVD+Ck6TL12hJHFHVySAP7I482lQU+SmE31OmDw==
答案 0 :(得分:0)
[HttpPost("/callback/thirdparty")]
[AllowAnonymous]
public IActionResult Thirdparty()
{
try
{
using (StreamReader reader = new StreamReader(Request.Body))
{
var body = reader.ReadToEnd();
现在我身上有绳子了!