In v19 R6, web requests can be performed by using 4D.HTTPRequest.new( ). The method accepts an options object as a second parameter. This object can be a simple object created with New object, or it can be an instance of a class created from cs.className.new( ). Passing an options object like this:
|$obj:=New object("method"; "POST")|
Is the same as passing an options object like this:
If the constructor for myClass was defined like this:
|Class constructor($method : Text)|
Both will define the HTTP method for the request as “POST”, for example.
Since simple objects cannot have functions as property values, it is recommended to use classes when defining callback functions, such as onResponse, for requests. Otherwise, if the web request is a simple, one-off call, a simple object would suffice to define HTTP method, headers, and body.