我正在尝试访问HEAD请求的状态代码。我如何访问相同的?
getNameObj(queryStr: string): Promise<any> {
return this.http.head(endpoints.getNamesUrl(queryStr))
.toPromise()
.then(this.handleResponse)
.catch(this.handleError);
}
private handleResponse(response: HttpResponseBase): Promise<any> {
console.log(response.status)
return Promise.resolve(response);
}
private handleError(error: HttpErrorResponse): Promise<any> {
return Promise.reject(error);
}
Alos,我收到错误ERROR Error: Uncaught (in promise): SyntaxError: Unexpected token o in JSON at position 1
SyntaxError: Unexpected token o in JSON at position 1...