首页 > 解决方案 > 如何在 NodeJs for Akamai 的 Axios 调用中设置 Keep Alive 时间

问题描述

我有一个问题,即在节点 js 应用程序等待 API 调用完成时,Akamai 服务器发送 503 错误。根据此处的 Akamai 文档,我想将超时值增加到 303 秒。我有以下 Axios 调用,我想为此增加超时。

const options = {
          method: 'POST',
          url: config.endpoint,
          headers:
            {
              'Content-Type': 'application/json;charset=utf-8',
              'Accept': 'application/json',
              authorization: 'Bearer ' + token,
            },
          data: data,
          json: true
        };

 axios(options)
          .then(response => convertObjectKeysToLowercasePromise(response.data))
          .then(response => {
         
            resolve(response)
          })
          .catch(function (error) {
              logger.error({
                message: `Error occured: ${error}`
                
              });
            }

如何按照 Akamai 的建议在这里增加 Keep alive 超时?

标签: node.jsaxiosakamai

解决方案


推荐阅读