beautypg.com

Os_http_request::method($val), Usage, Input parameters – Brocade Virtual ADX OpenScript API Guide (Supporting ADX v03.1.00) User Manual

Page 50: Return values, Example, Context

background image

38

Brocade Virtual ADX OpenScript API Guide

53-1003243-01

Methods

5

Usage

Can be used to perform load-balancing based on the method.

Input Parameters

None.

Return Values

The following table contains the return values.

Example

OS_HTTP_REQUEST::method($val)

Sets the value of the method type to the value specified in $val.

Context

HTTP request event. If called in the HTTP response context, undefined will be returned.

Usage

Can be used to rewrite the method.

TABLE 29

Return Values

Name

Type

Description

string

value of the method type if
present. If not present,
undefined is returned.

use OS_HTTP_REQUEST;

use OS_SLB;

sub HTTP_REQUEST{

my $method = OS_HTTP_REQUEST::method;

if ( defined $method && $method eq "GET" ) {

OS_SLB::forward(1);

} elsif (defined $method && $method eq "POST" ) {

OS_SLB::forward(2);

} else {

OS_SLB::foward(10);

}

}