获取httpclient请求查询参数

时间:2018-03-17 16:48:38

标签: angular-httpclient angular-http-auth angular-httpclient-interceptors

您好我正在使用Angular 5拦截器检查HttpClient请求URL是否包含查询参数但是它总是返回false,即使在网络中我看到传递的查询参数。

import { HttpEvent, HttpInterceptor, HttpHandler, HttpRequest, HttpParams } from '@angular/common/http';
...

intercept (req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
if (!req.params.has('X-Amz-Algorithm')) {
    do something
} else {}
}

有人可以帮我解决如何检索HttpRequest中使用的查询参数。谢谢!

0 个答案:

没有答案
相关问题