In v19 R6, HTTP requests can be performed using the HTTPRequest class, and callbacks can be implemented using an HTTPRequest options class. When programming various callback functions into an options class, it is important to know the order in which each callback would be executed. If all functions are defined, below is the chain of callback events:
Note that some callbacks (onHeaders and onTerminate) are always called, while others may never be executed, depending on the situation, such as onData if there is no body in the request. The onError and onResponse callbacks are 3a and 3b because if one occurs, the other does not. If an error occurs from the request, onError is executed and onResponse is skipped, and vice versa if an error does not occur.