- All Implemented Interfaces:
- WarpScriptStackFunction
public class HTTP
extends NamedWarpScriptFunction
implements WarpScriptStackFunction
Send an HTTP request to a url
Capabilities:
- http.requests (maximum number of calls)
- http.size (maximum download size in number of bytes)
- http.chunksize (maximum chunk size in number of bytes)
- if the configuration parameter warpscript.http.capability exists,
then its value is a capability that is checked to enable usage of this function
Params:
url The URL to send the request to. Must begin with http:// or https://
method The optional http method. Default to GET
headers An optional header map
body An optional body. UTF-8 STRING or BYTES
chunk.size Chunk size
chunk.macro A macro that is executed whenever a chunk has been downloaded. It expects a MAP that contains chunk number (a LONG), status code (a LONG), status message (a STRING), headers (a MAP), and chunk content (a BYTES objects)
username Optional field. If both username and password field are present, basic authentication will be performed
password Optional field. If both username and password field are present, basic authentication will be performed
Output:
RESPONSE A map that contains status code (a LONG), status message (a STRING), headers (a MAP) and full content of the response (a BYTES objects). The content is empty if chunk option is used