validate_response

This subroutine allows validating an HTTP response from a buffer.

Syntax

gosub validate_response({my_buffer})

Code snippet

subroutine validate_response {
    if (${HTTP_STATUS_CODE} != 200) {
        print Got HTTP status ${HTTP_STATUS_CODE}, expected a status of 200
        print The server response was:
        json format ${SUBARG_1}
        print ${SUBARG_1}
        terminate with error
    }
}

Last updated