Http 角度5:请求选项,请求选项参数-角度5中的模拟是什么

Http 角度5:请求选项,请求选项参数-角度5中的模拟是什么,http,angular5,httpclient,Http,Angular5,Httpclient,我致力于将ng 4迁移到ng 5,并面临 只是一个例子,我想用这个方法转到ng5 getRequestOptions(): RequestOptionsArgs { const options = new RequestOptions(); options.headers = new Headers({ 'Content-Type': 'application/json', 'X-Requested-With': 'XMLHttpRequest',

我致力于将ng 4迁移到ng 5,并面临

只是一个例子,我想用这个方法转到ng5

getRequestOptions(): RequestOptionsArgs {
    const options = new RequestOptions();
    options.headers = new Headers({
        'Content-Type': 'application/json',
        'X-Requested-With': 'XMLHttpRequest',
    });

    const searchParams = new URLSearchParams();
    options.search = searchParams;

    return options;
}
第一个问题:
angular 5中的RequestOptions参数类似于什么?

您可以使用常规对象来表示传递请求的选项。您是否在文档中看到了
HttpClient
的文档?他们解释得很好。