http statusCode sometimes undefined

前端 未结 1 1963
说谎
说谎 2020-12-29 16:16

I\'m using request module in my node.js(express) application. Sometimes this statusCode related error occurs:

TypeError: Cannot read property
\'statusCode\'          


        
相关标签:
1条回答
  • 2020-12-29 16:33

    This is a workaround, as there might be several reasons why response is undefined:

    if (!error && response.statusCode == 200) {
        // do your stuff here..
    }
    
    0 讨论(0)
提交回复
热议问题