Extension: io.warp10.script.ext.http.HttpWarpScriptExtension

extensions web
Configuration parameters

The HTTP function sends an HTTP request, waits for the response then returns it. The input is a MAP with at least the field url. The response is a MAP with the fields status.code, status.message, headers and content.

The HTTP function can also be used in streaming mode by providing a positive chunk.size argument. In streaming mode, whenever chunk.size bytes are downloaded, a response MAP with the additional field chunk.number is pushed onto the stack and the macro given as chunk.macro argument is being executed. Finally, a last chunk.macro execution is done on a chunk response that has empty content and chunk.number = -1.

The HTTP function makes use of token's capabilities to raise the initial limits per warpscript (set from configurations).

Other configurable options:

HTTP is available since version 2.8.1.

See also



{ 'url' 'https://httpbin.org/anything' } HTTP
{ 'method' 'POST' 'url' 'http://localhost:8080/api/v0/exec' 'headers' {} 'body' '"" 1 100 <%25 TOSTRING + %25> FOR' 'chunk.size' 64 'chunk.macro' <% 'content' GET %> } HTTP


return HTTP( { 'url': 'https://httpbin.org/anything' } )