IDOL Server 12.12

# send

The `send` method sends the HTTP request.

## Syntax

    send()

## Returns

(LuaHttpResponse). A LuaHttpResponse object.

The `send` method can throw an exception if the request fails. You can catch an exception by calling the method using the Lua function `pcall`.

## Example

The following example shows how to send a request:

    local config_string = [===[
    [HTTP]
    ProxyHost=proxy
    ProxyPort=8080
    SSLMethod=NEGOTIATE
    ]===]

    local config = LuaConfig:new(config_string)
    local request = LuaHttpRequest:new(config, "HTTP")
    request:set_url("https://www.example.com")
    request:set_method("GET")

    local result, response = pcall(LuaHttpRequest.send, request)

    if (result) then
        print ("Success: " , response:get_http_code())
    else
        print ("Error: " , response)
    end

When the `send` method is successful, the `result` variable is `true` and `response` is a LuaHttpResponse object. If an exception is thrown from the `send` method, the `result` variable is `false` and `response` contains the error message.

© Copyright 2022 Micro Focus or one of its affiliates
Version 12.12 | Last updated June 2022

Send documentation feedback

Close

Send documentation feedback

To send feedback using your default email client, open an email window.

Otherwise, send your feedback and the information below to swpdl.idoldocsfeedback@microfocus.com.

We appreciate your feedback!

Product: IDOL Server 12.12

Topic Title: send