- AspNetCore 2.0.1 (WebAPI project)
   - Using Swashbuckle.AspNetCore 1.1.0
   - Chrome v 63.0.3239.84

We have a controller endpoint that looks like this:

[HttpGet("{id:Guid}")]
public async Task<IActionResult> Get(Guid id)
{
   try
   {
       var docBytes = await _service.GeneratePdfAsync(id).ConfigureAwait(
false);

       if (docBytes == null) return NotFound();

       return File(docBytes, "application/pdf", FileName);
    }
    catch (Exception e)
    {
       return StatusCode(500, GenerationErrorMessage);
    }
}

The test I've been running against this endpoint should return a 3 page PDF 
with content and images.

I am able to download the file SwaggerUI provides via link after a 
successful response from the API. When I view the downloaded PDF in a 
browser (Chrome), none of the images display correctly (I get black boxes), 
and there's an empty 4th page. When I view the downloaded PDF in Adobe 
Touch, it's 4 blank pages.

If I hit the same endpoint using Postman, it gives me the PDF to download, 
and the PDF looks as it should. We also have a console app that hits the 
API and saves the PDF to disk, which also looks fine.

Is there a known issue with SwaggerUI downloading PDFs in this manner? Am I 
missing some attribute on the endpoint that would give Swagger more 
specific into to properly download the file?

-- 
You received this message because you are subscribed to the Google Groups 
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to