在请求标头中设置了角度标头

时间:2019-03-29 12:41:52

标签: java angular

我有一个有角度的项目,在我的服务类中,我在请求中设置标头,但在标头中设置了值,我该如何解决?

我在这里尝试过服务器端和角度端。

return this.httpClient.post(this.baseUrl+'addkeystore',params,{ headers: new HttpHeaders({'tenantID': "123"}) });

在我的服务器端

    HttpServletRequest req = (HttpServletRequest) request;
    HttpServletResponse res = (HttpServletResponse) response;

    res.setHeader("Access-Control-Allow-Origin","*");
    res.setHeader("Access-Control-Allow-Credentials", "true");
    res.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
    res.setHeader("Access-Control-Max-Age", "3600");
    res.setHeader("Access-Control-Allow-Headers", "Content-Type, Accept, X-Requested-With, remember-me");

0 个答案:

没有答案