How to set headers for a certain state

I need to show a PDF file from blob. Ideally using PHP, I would send header information as shown below.

$gotten = @mysql_query(“select * from pdf order by pid desc limit 1”);
$row = @mysql_fetch_assoc($gotten);
$bytes = $row[data];
header(“Content-type: application/pdf”);
header(‘Content-disposition: attachment; filename=“thing.pdf”’);
print $bytes;

Can someone please help with its equivalent in ionic.

if you send a request with the $http service you can set the headers as easy as in php.$http

  method: 'GET',
  url: 'XXXXX',
  headers: {
    'Content-Type': 'application/pdf'
1 Like