Project

General

Profile

[Solved] question on writing a test case

Added by simoncpu about 12 years ago

Hi, I'm trying to write a test case for SERVER_NAME on IPv6. I'm a bit confused with the existing test case:

    $t->{REQUEST}  = ( <<EOF
GET /get-server-env.php?env=SERVER_NAME HTTP/1.0
Host: foo.example.org
EOF
 );
    $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'www.example.org' } ];
    ok($tf->handle_http($t) == 0, 'SERVER_NAME');

Does the above lines check if SERVER_NAME contains www.example.org instead of foo.example.org?

Thanks...


Replies (1)

RE: question on writing a test case - Added by gstrauss over 7 years ago

The target script sends a response body containing the value of $SERVER_NAME in the CGI environment that the script was given.

Therefore, yes, the $t->{RESPONSE} is checking that the response body is "www.example.org"

    (1-1/1)