With Postman, I am sending to my service a GET request with Header to Accept "application/pdf" and Accept-Encoding "gzip, deflate, br, *".
On code side,
byte[] pdf_test = System.IO.File.ReadAllBytes(@"C:\somewhere\hello.pdf");
OkObjectResult output = new OkObjectResult(pdf_test); // uncomment below once done.
output.ContentTypes.Add(@"application/pdf"); // LINE IN QUESTION
// And finally, back to the remote caller.
return output;
When I debug this code, the status code is 200, and ContentTypes
having "aplication/pdf". With Value having all the bytes of pdf.
When postman receives the response, I see the return code as 406 Not Acceptable.
The weird thing is, when I comment out the "LINE IN QUESTION" from above, the Postman receives message with 200 OK. But Content-Type accepted as "application/json".
Why is this occuring?
Postman ultimately does not matter but real program is expecting "application/pdf" content type, this real program does not exist yet. So at least I would like to get my side correctly done.
Thanks in advance.