如何在@apollo/datasource-rest 中使用客户端证书

问题描述 投票:0回答:1

我正在使用

@apollo/datasource-rest
的子类从我的项目中的 REST API 获取数据。我需要在我的子类中提出的每个请求中添加一个客户端证书。我知道可以在 https
https.Agent
中添加证书,它可以在以前版本的 apollo 数据源中使用 rest
apollo-datasource-rest
像这样

this.get(<reqparams> , {agent : <https agent with certificate>})

不确定如何与新版本的 apollo datasouce 一起使用 (

@apollo/datasource-rest
)

node.js apollo-server apollo-datasource-rest
1个回答
0
投票

如果要使用自定义代理,则需要将自定义

fetch
传递给
RESTDataSource
FetcherRequestInit 类型中明确指出缺少对代理的支持:

  // We explicitly do not support non-portable options like `node-fetch`'s
  // `agent`.
© www.soinside.com 2019 - 2024. All rights reserved.