gpt4 book ai didi

angular - 标题未设置

转载 作者:可可西里 更新时间:2023-11-01 17:26:09 24 4
gpt4 key购买 nike

<分区>

我正在使用 HttpClient 发出请求,并且在每个请求上我都设置了 header ,但是当我看到 chrome 网络选项卡时,这些 header 没有设置。

代码

request(url: string, method: string, body?: Object) {
// debugger;

const fullUrl: string = this.baseUrl + '/' + url;
var data: Object = new Object();

const headers = new HttpHeaders();
headers.append('Access-Control-Allow-Origin', '*');
headers.append('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE');
headers.append('Access-Control-Allow-Headers', "X-Requested-With, Content-Type");
headers.append('Authorization', 'Bearer '+this.auth.getToken());
headers.append('Accept', 'application/json');

data['headers'] = headers;


if (body) {
// debugger;
data['body'] = body;
}


return this.http.request(method, fullUrl, data)
.map((res: Response) => res)
.catch((err: Response) => this.onRequestError(err));
}

网络标签的图片

Chrome Network Tab

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com