用户代理值被默认值替换

时间:2021-02-17 11:10:17

标签: javascript jquery sharepoint-online spfx pnp-js

我们正在使用 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;

}

0 个答案:

没有答案