小编chu*_*ugs的帖子

将获取响应标头转发到 Apollo graphql 响应

我在 Apollo/Graphql Expressjs 服务器上设置了 apollo-datasource-rest 数据源。我想将 fetch 响应中的一些标头转发到 /graphql 响应。

这是流程:

POST /graphql

Graphql makes fetch request using this.get('http://example.com/api')
Response from this fetch contains the header "cache-status"

Response from /graphql
I'd like to include the "cache-status" header from the example.com/api response here in the /graphql response
Run Code Online (Sandbox Code Playgroud)

我在其余数据源类的 didReceiveResponse() 方法中看到了标头。我不确定这是访问和存储它的正确位置。如何在 POST /graphql 响应中包含“cache-status”标头?

express apollo graphql apollo-server

5
推荐指数
1
解决办法
1697
查看次数

标签 统计

apollo ×1

apollo-server ×1

express ×1

graphql ×1