axios获取,放置,发布方法请求失败,状态码为403

Error: Request failed with status code 403
    at createError (C:\Yatin\API\node_modules\axios\lib\core\createError.js:16:15)
    at settle (C:\Yatin\API\node_modules\axios\lib\core\settle.js:17:12)
    at IncomingMessage.handleStreamEnd (C:\Yatin\API\node_modules\axios\lib\adapters\http.js:237:11)
    at IncomingMessage.emit (events.js:203:15)
    at endReadableNT (_stream_readable.js:1145:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)

当我在函数中执行以下代码时,它显示上述错误。直到一段时间后,它的运行状况还算不错,但是突然之间,它现在不起作用了。

var azureREST_listContainerURI = <URL_that is generated here by calling other functions>
axios({
            method: 'get',url: azureREST_listContainerURI
          })
           .then(function (response) {

            parser.parseString(response.data,function (err,result) {
                if(err) throw err
              for(let containerObj of result.EnumerationResults.Containers[0].Container)
              {
                  var containerobject = {
                      "Name":containerObj['Name'][0],"properties":{
                          "last_modified":containerObj['Properties'][0]['Last-Modified'][0]
                          }
                      }
                      customJSONResponse['containers'].push(containerobject);
              }
              res.send(customJSONResponse) 
           })
          })
           .catch(function (error) {
           res.send({error:error})
           console.log(error.stack)
            console.log("Error while calling Azure REST endpoint : " + error);
           });

这不起作用并显示上述错误,尽管当我尝试通过硬编码单引号内的axios.get中的url参数来执行相同的代码时,它绝对可以正常工作。

xianggujidan 回答:axios获取,放置,发布方法请求失败,状态码为403

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3125653.html

大家都在问