尝试通过Angular 6代码通过http调用Jasper报告,然后在Chrome中以PDF格式显示。
.net中有HttpWebResponse,用于进行调用并向请求添加标头,我们如何在Angular 6中实现等效。
HttpWebRequest request = WebRequest.Create(URL ADDRESS)
request.Headers.Add(credentials)
request.Method = "GET";
request.ContentType = "text/xml";
HttpWebResponse response;
using (response = request.GetResponse() as HttpWebResponse)
{
// Get the response stream
StreamReader reader = new
StreamReader(response.GetResponseStream(), Encoding.UTF8);
StreamReader reader = new
StreamReader(response.GetResponseStream());
results = reader.ReadToEnd();
}