aliyun / api-gateway-nodejs-sdk

The API Gateway SDK for Node.js
MIT License
107 stars 23 forks source link

失败时没有返回错误信息 #31

Closed xuxucode closed 3 years ago

xuxucode commented 4 years ago

error message 信息为空,看不出来错误原因:

umengerr
FunkySamuel37 commented 3 years ago

The body of error is messing. @JacksonTian @wangzishi @fredlong curl result:

> curl -i -k -X GET 'https://shixin.market.alicloudapi.com/creditblacklist/query?idcard=xxx&realname=xxx'  -H 'Authorization:APPCODE xxx'

HTTP/1.1 404 Not Found
Server: Tengine
Date: Wed, 18 Aug 2021 04:39:33 GMT
Content-Type: application/json; charset=UTF-8
Content-Length: 49
Connection: keep-alive
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET,POST,PUT,DELETE,HEAD,OPTIONS,PATCH
Access-Control-Allow-Headers: X-Requested-With,X-Sequence,X-Ca-Key,X-Ca-Secret,X-Ca-Version,X-Ca-Timestamp,X-Ca-Nonce,X-Ca-API-Key,X-Ca-Stage,X-Ca-Client-DeviceId,X-Ca-Client-AppId,X-Ca-Signature,X-Ca-Signature-Headers,X-Ca-Signature-Method,X-Forwarded-For,X-Ca-Date,X-Ca-Request-Mode,Authorization,Content-Type,Accept,Accept-Ranges,Cache-Control,Range,Content-MD5
Access-Control-Max-Age: 172800
X-Ca-Request-Id: 8DD022A8-D3FE-4753-A7BA-242774F9C783
X-Ca-Error-Message: Not Found
X-Powered-By: PHP/7.1.28

{"status":"210","msg":"没有信息","result":""}

api-gateway-nodejs-sdk result:

Error: GET 'https://shixin.market.alicloudapi.com/creditblacklist/query?idcard=xxx&realname=xxx' failed width code(404). request id: D1601D75-6344-4206-9E23-EFBE9028FFC2, error message: Not Found
    at SimpleClient.request (/Users/samuel37/code/cube/node_modules/aliyun-api-gateway/lib/simple-client.js:39:17)
    at processTicksAndRejections (internal/process/task_queues.js:97:5) {
  code: 404,
  data: {
    headers: {
      server: 'Tengine',
      date: 'Wed, 18 Aug 2021 04:04:22 GMT',
      'content-type': 'application/json; charset=UTF-8',
      'content-length': '49',
      connection: 'keep-alive',
      'access-control-allow-origin': '*',
      'access-control-allow-methods': 'GET,POST,PUT,DELETE,HEAD,OPTIONS,PATCH',
      'access-control-allow-headers': 'X-Requested-With,X-Sequence,X-Ca-Key,X-Ca-Secret,X-Ca-Version,X-Ca-Timestamp,X-Ca-Nonce,X-Ca-API-Key,X-Ca-Stage,X-Ca-Client-DeviceId,X-Ca-Client-AppId,X-Ca-Signature,X-Ca-Signature-Headers,X-Ca-Signature-Method,X-Forwarded-For,X-Ca-Date,X-Ca-Request-Mode,Authorization,Content-Type,Accept,Accept-Ranges,Cache-Control,Range,Content-MD5',
      'access-control-max-age': '172800',
      'x-ca-request-id': 'D1601D75-6344-4206-9E23-EFBE9028FFC2',
      'x-powered-by': 'PHP/7.1.28',
      'x-ca-error-message': 'Not Found'
    }
  }
}

https://github.com/aliyun/api-gateway-nodejs-sdk/blob/master/lib/client.js#L174-L191