Request mydomain/request
returns json string like "accepted"
or "declined"
I would use request in angular to get this string :
getStatus(jobOfferId): Promise<string> {
const url = "someurl";
return this.httpClientService.get(url)
.toPromise()
.then(response => response as string);
}
This would work in angular 2, but I've just upgraded to angular 4 and this request returns an error instead
"Http failure during parsing for https://mydomain/request"
JSON is the default expected response type. You can try forcing using "text" instead and print the result just to understand what is happening:
httpClient.get('http://some.com/endpoint/', { responseType: 'text' }).subscribe(result => {
console.log(result);
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.