我们正在使用 pnp js 并设置如下所示的用户代理,但它被 Chrome 默认用户代理取代:
public GetItemsAsync = async (LibName: string) => {
let web = new Web(this.props.webUrl);
const headers = {Accept: "application/json;odata=nometadata",
'User-Agent': "NONISV|Microsoft|xxx-xxx-xxx-xxx/2.0",
'X-ClientTag': "User-Agent"};
const allItems: any[] = await
web.lists.getByTitle(LibName).configure({headers}).items.top(5000).getAll();
return allItems;
}