proudmonkey / AutoWrapper

A simple, yet customizable global exception handler and Http response wrapper for ASP.NET Core APIs.
MIT License
679 stars 82 forks source link

reponse containing html code string return 404 through antoAwrapper #126

Open scil opened 2 years ago

scil commented 2 years ago

I return html code string and get 404 ,and the wanted data in the exceptionMessage


{
  "isError": true,
  "responseException": {
    "exceptionMessage": {

      "commentList": [
        {
          "id": 19,
          "createdUser": "4k2n1gmr4zt5w03t0xg075p4wn"
        }
      ],

      "pagerHtml": "\r\n<ul class=\"pager\"><li class=\"disabled first\"><a>&lt;&lt;</a></li><li class=\"disabled\"><a rel=\"prev\">&lt;</a></li><li class=\"active\"><a href=\"/api/common/comment/Index?AuditStatus=030203&amp;Status=1&amp;page=1\">1</a></li><li><a href=\"/api/common/comment/Index?AuditStatus=030203&amp;Status=1&amp;page=2\" rel=\"next\">2</a></li><li><a href=\"/api/common/comment/Index?AuditStatus=030203&amp;Status=1&amp;page=2\" rel=\"next\">&gt;</a></li><li class=\"last\"><a href=\"/api/common/comment/Index?AuditStatus=030203&amp;Status=1&amp;page=2\">&gt;&gt;</a></li></ul>\r\n"
    }
  }
}

I tried new ApiResponse and failed


{
  "isError": true,
  "responseException": {
    "exceptionMessage": {
      "version": "1.0.0.0",
      "statusCode": 200,
      "message": "GET Request successful.",
      "responseException": null,
      "result": {
        "contentType": null,
        "serializerSettings": null,
        "statusCode": null,
        "value": {
          "commentList": [
          {
            "id": 19,
            "createdUser": "4k2n1gmr4zt5w03t0xg075p4wn"
          }
          ],

          "pagerHtml": "\r\n<ul class=\"pager\"><li class=\"disabled first\"><a>&lt;&lt;</a></li><li class=\"disabled\"><a rel=\"prev\">&lt;</a></li><li class=\"active\"><a href=\"/api/common/comment/Index?AuditStatus=030203&amp;Status=1&amp;page=1\">1</a></li><li><a href=\"/api/common/comment/Index?AuditStatus=030203&amp;Status=1&amp;page=2\" rel=\"next\">2</a></li><li><a href=\"/api/common/comment/Index?AuditStatus=030203&amp;Status=1&amp;page=2\" rel=\"next\">&gt;</a></li><li class=\"last\"><a href=\"/api/common/comment/Index?AuditStatus=030203&amp;Status=1&amp;page=2\">&gt;&gt;</a></li></ul>\r\n"
        }
      }
    }
  }
}```
SaravananArunagiri commented 1 year ago

use BypassHTMLValidation = true,

will resolve your issue.