Kernel::GenericInterface::Transport::HTTP::Test

NAME

Kernel::GenericInterface::Transport::HTTP::Test – GenericInterface network transport interface for testing purposes

PUBLIC INTERFACE

SYNOPSIS

usually, you want to create an instance of this by using Kernel::GenericInterface::Transport->new();

    use Kernel::GenericInterface::Transport;

    my $TransportObject = Kernel::GenericInterface::Transport->new(

        TransportConfig => {
            Type => 'HTTP::Test',
            Config => {
                Fail => 0,  # 0 or 1
            },
        },
    );

In the config parameter 'Fail' you can tell the transport to simulate failed network requests. If 'Fail' is set to 0, the transport will return the query string of the requests as return data (see "RequesterPerformRequest()" for an example);

ProviderProcessRequest()

this will read the incoming HTTP request via CGI and return the HTTP parameters in the data hash.

ProviderGenerateResponse()

this will generate a query string from the passed data hash and generate an HTTP response with this string as the body. This response will be printed so that the web server will send it to the client.

RequesterPerformRequest()

in Fail mode, returns error status. Otherwise, returns the query string generated out of the data for the HTTP response.

    my $Result = $TransportObject->RequesterPerformRequest(
        Data => {
            A => 'A',
            b => 'b',
        },
    );

Returns

    $Result = {
        Success => 1,
        Data => {
            ResponseData => 'A=A&b=b',
        },
    };
Scroll to Top