The Http get request returns and xsd file content, below is the code snippet
headers = headers.append('Content-Type', 'text/plain');
headers = headers.append('responseType', 'text');
headers = headers.append('Accept', 'application/octet-stream');
retun this.http.get(data[0]._links['http://identifiers.emc.com/content-download'].href, { headers: headers }))
.map((response: Response) => {
let data: any;
data = response;
return content;
})
The code fails with the error
"SyntaxError: Unexpected token < in JSON at position 0 at JSON.parse" Http failure during parsing for "request url"
I have added the "requestType:text" to the header, am I missing something, why it is trying to parse thinking the response is of JSON ?
below are the snapshots of request and response headers
Response header Request header
Below is the sample of response
<!--
~ Copyright (c) OpenText Corporation. All Rights Reserved.
-->
<xs:schema elementFormDefault="qualified" targetNamespace="urn:eas-samples:en:xsd:phonecalls.1.0" version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Calls">
<xs:complexType>
<xs:sequence maxOccurs="unbounded">
<xs:element name="Call">
<xs:complexType>
<xs:sequence>
<xs:element name="SentToArchiveDate" type="xs:date"/>
<xs:element name="CallStartDate" type="xs:dateTime"/>
<xs:element name="CallEndDate" type="xs:dateTime"/>
<xs:element name="CallFromPhoneNumber">
<xs:simpleType>
<xs:restriction base="xs:positiveInteger">
<xs:minInclusive value="1"/>
<xs:totalDigits value="11"/>
</xs:restriction>
</xs:simpleType>
</xs:element