最近在学习 angular,请问如何通过 HttpClient 发生 http head 请求并获取 response status code?
通过下面的代码实现了
this.httpClient.head("/auth/is-signed-in", { observe: 'response' }).pipe(
map(response => {
console.log(response.status);
}),
catchError(error => {
console.log(error.status);
return of(undefined);
})
).subscribe();