graph - Microsoft Graph Toolkit (MGT) - How do I modify/add request headers for the MGT-GET component?
问题描述
Trying to figure out how to modify request headers for the graph client toolkit and have it apply when using the GET component. I don't necessarily want to override the entire graph client.
For reference, here's how you do it:
// Already likely on page, adding as reference
TeamsProvider.microsoftTeamsLib = microsoftTeams;
const provider = new TeamsProvider(config);
const options = {
authProvider: provider,
fetchOptions: { headers: {'ConsistencyLevel':'eventual'}}
};
const client = Client.initWithMiddleware(options);
provider.graph = new Graph(client)
// Now set provider with new graph
Providers.globalProvider = provider
解决方案
推荐阅读
- android - 当错误说它不应该时,为什么这在 api 21 上有效
- qt - 较早创建但较晚启动的 QTimer 不起作用
- javascript - 如何正确地将 keyup() 函数应用于具有不同输入的不同 DOM 元素?
- salesforce - 如何在商机的自定义字段中报告序列化数据?
- java - ReentrantLock tryLock(timeout,timeUnit) 无法按预期工作
- swift - 点击 UINavigationController UINavigationTabBar Item 时如何调用函数?
- javascript - Jquery 函数没有在应该的时候向 Dom 元素添加类。尝试构建按钮功能幻灯片
- android - 在 SSLContext 中使用硬件支持的密钥
- c++ - 使用柯南包管理器提升链接错误
- html - 带有两个可折叠左侧导航的三列布局