首页 文章

使用HttpHeaders的Angular 5 JSONP请求

提问于
浏览
2

我正在尝试使用一些HTTP标头参数执行JSONP请求 . 使用 http.get 很简单:

let header = new HttpHeaders();
header.append(<header_param_name>, <header_param_value>);

this.http.get(<my_url>, { headers: header})

但当我尝试用 jsonp 做同样的事情时......

this.http.jsonp(<my_url>, <callback_param>)

where is the "options" parameter??? O_o如何在JSONP请求中的请求头中发送参数?

谢谢你的回复

1 回答

  • 0

    official documentation

    必须安装合适的拦截器(例如通过HttpClientJsonpModule) . 如果没有达到此类拦截器,则配置的后端可能会拒绝JSONP请求 .

相关问题