All Products
Search
Document Center

API Gateway:Empty return value

Last Updated:Dec 01, 2017

The returned result of an HTTP/HTTPS request consists of the HTTPCode, Header, and Body. When a request fails, the returned Body may be empty because the request does not enter the business logic. The error “The return value is empty.” is returned. However, the important portion of the message is contained in the Header.

If an API request initiated by a user reaches the gateway, the gateway returns the result message indicating a request success or failure.

The majority of the returned messages are contained in the Header. Messages starting with X-Ca are returned from the gateway. Important messages include:

  1. X-Ca-Request-Id: 7AD052CB-EE8B-4DFD-BBAF-EFB340E0A5AF
  2. //The unique ID of the request. Once the request reaches the API gateway, the API gateway generates a request ID and returns it to the client through the response header. We recommend that you record the request ID in both the client and backend services for troubleshooting and tracing.
  3. X-Ca-Error-Message: Invalid Url
  4. //An error message returned from the API Gateway. When a request fails, the API Gateway returns the error message to the client through the response header.
  5. X-Ca-Debug-Info: {"ServiceLatency":0,"TotalLatency":2}
  6. //A debug message returned when the debug mode is enabled. The message can be changed later and is used only for reference at the debugging stage.

Therefore, if the returned message of a request is empty, check the returned Header. In normal cases, the Body is empty when the request reaches the gateway and an error is returned stating “The return value is empty.” However, the important portion of the message is contained in the Header.

If the Header is also empty, the request did not reach the gateway. Check your network conditions.

You can search for methods to obtain and view the HTTP/HTTPS request headers in different languages.