C# 重定向响应未显示为虚张声势/虚张声势

C# 重定向响应未显示为虚张声势/虚张声势,c#,asp.net,swagger,swagger-ui,swashbuckle,C#,Asp.net,Swagger,Swagger Ui,Swashbuckle,我正在使用带Asp.Net的Swashback.Core为我的API返回IHttpActionResult。问题是,Swagger中的响应返回的响应代码为0,响应正文不包含任何内容,但当我通过邮递员进行相同的呼叫时,将返回我重定向到的图像,响应代码为200(这是我想要的行为) swagger允许这样的重定向吗?是否有我缺少的设置或关于如何修复此问题的任何其他建议 我返回的IHttpActionResult: public class ImageResponse : IHttpActionResu

我正在使用带Asp.Net的Swashback.Core为我的API返回IHttpActionResult。问题是,Swagger中的响应返回的响应代码为0,响应正文不包含任何内容,但当我通过邮递员进行相同的呼叫时,将返回我重定向到的图像,响应代码为200(这是我想要的行为)

swagger允许这样的重定向吗?是否有我缺少的设置或关于如何修复此问题的任何其他建议

我返回的IHttpActionResult:

public class ImageResponse : IHttpActionResult
    {
        private readonly string filePath;

        public LegacyImageResult(string filePath)
        {
            this.filePath = filePath;
        }

        private HttpResponseMessage Execute()
        {
            HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.Redirect);

            try
            {
                if (filePath == null)
                {
                    return new HttpResponseMessage(HttpStatusCode.NotFound) { Content = new StringContent("Image not found.") };
                }
                response.Headers.Location = new Uri(filePath);
            }
            catch
            {
                response.Dispose();
                throw;
            }

            return response;
        }
    }
编辑:

看来这是一个众所周知的招摇过市的问题