Please enable JavaScript to view this site.

A-Shell Reference

Navigation: Subroutines > HTTP

Retrieving HTTP status text

Scroll Prev Top Next More

In cases where the routine succeeds in connecting to the server, the status parameter will return the numeric HTTP status code, which is generally sufficient, along with the body of the response, to determine if the operation was a logical success. In some cases however, the HTTP status code may be ambiguous, and the server may augment it with a non-obvious text message returned on the HTTP status line (rather than something more formal/detailed returned as the body of the response). You can retrieve that status string by making a second XCALL HTTP call following the initial one. The example below illustrates a case where upon receiving status 400 (bad request), we retrieve the HTTP status string, which hopefully contains some further detail helping clarify what is bad about the request, such as "unrecognized part number format:"

xcall HTTP, 1, status, flags, url$, request$, response$

if status = 400 then

    xcall HTTP, 1, status, XHTTPF_GETSTSTXT, "", "", status'text$

endif

 

Note that the HTTP status text may also be found at the end of the ashnet.log entry if the XHTTPF_DEBUG flag is set.

History

2018 May, A-Shell 6.4.1555, ASHNET 1.11.162:  Append Connection Failure Codes to the XHTTPF_GETSTSTXT return string, as well as the ashnet.log file to assist with debugging failed connections