NAME
Example of CGI test
SYNOPSIS
ScriptAlias "/myapp" "/path/to/test.cgi"
# ... or:
# ScriptAliasMatch "^/myapp" "/path/to/test.cgi"
DESCRIPTION
The script demonstrate various examples of how WWW::MLite work.
METHODS
WWW::MLite methods
GET /myapp
curl -v --raw http://localhost/myapp
> GET /myapp HTTP/1.1
> Host: localhost
> User-Agent: curl/7.50.1
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Fri, 31 May 2019 05:37:27 GMT
< Server: Apache/2.4.18 (Ubuntu)
< Connection: close
< Content-Length: 462
< Vary: Accept-Encoding
< Content-Type: text/plain
<
{
'attrs' => {
'bar' => 'on',
'deserialize' => 0,
'foo' => 'blah-blah-blah',
'serialize' => 1
},
'description' => 'Index page',
'method' => 'GET',
'name' => 'getIndex',
'params' => [
bless( {
'.charset' => 'ISO-8859-1',
'.fieldnames' => {},
'.parameters' => [],
'escape' => 1,
'param' => {},
'use_tempfile' => 1
}, 'CGI' )
],
'path' => '/myapp',
'requires' => [],
'returns' => {}
}
GET /myapp/foo
curl -v --raw http://localhost/myapp/foo
> GET /myapp/foo HTTP/1.1
> Host: localhost
> User-Agent: curl/7.50.1
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Fri, 31 May 2019 05:41:34 GMT
< Server: Apache/2.4.18 (Ubuntu)
< Connection: close
< Content-Length: 16
< Content-Type: text/plain
<
Blah-Blah-Blah!
GET /myapp/void
curl -v --raw http://localhost/myapp/void
> GET /myapp/void HTTP/1.1
> Host: localhost
> User-Agent: curl/7.50.1
> Accept: */*
>
< HTTP/1.1 204 No Content
< Date: Fri, 31 May 2019 06:03:53 GMT
< Server: Apache/2.4.18 (Ubuntu)
< Connection: close
< Content-Type: text/plain
<
GET /myapp/dump
curl -v --raw http://localhost/myapp/dump
> GET /myapp/dump HTTP/1.1
> Host: localhost
> User-Agent: curl/7.50.1
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Fri, 31 May 2019 06:04:49 GMT
< Server: Apache/2.4.18 (Ubuntu)
< Connection: close
< Content-Length: 3912
< Vary: Accept-Encoding
< Content-Type: text/plain
<
GET /myapp/env
curl -v --raw http://localhost/myapp/env
> GET /myapp/env HTTP/1.1
> Host: localhost
> User-Agent: curl/7.50.1
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Fri, 31 May 2019 06:45:29 GMT
< Server: Apache/2.4.18 (Ubuntu)
< Connection: close
< Content-Length: 1007
< Vary: Accept-Encoding
< Content-Type: text/plain
<
POST /myapp
curl -v -d '{"object": "list_services"}' --raw -H "Content-Type: application/json" http://localhost/myapp
> POST /myapp HTTP/1.1
> Host: localhost
> User-Agent: curl/7.50.1
> Accept: */*
> Content-Type: application/json
> Content-Length: 27
>
< HTTP/1.1 200 OK
< Date: Fri, 31 May 2019 06:51:16 GMT
< Server: Apache/2.4.18 (Ubuntu)
< Connection: close
< Content-Length: 27
< Content-Type: text/plain
<
{"object": "list_services"}
PUT /myapp
curl -X PUT -v -d 'My post data' --raw -H "Content-Type: text/plain" http://localhost/myapp
> PUT /myapp HTTP/1.1
> Host: localhost
> User-Agent: curl/7.50.1
> Accept: */*
> Content-Type: text/plain
> Content-Length: 12
>
< HTTP/1.1 200 OK
< Date: Fri, 31 May 2019 06:55:00 GMT
< Server: Apache/2.4.18 (Ubuntu)
< Connection: close
< Content-Length: 12
< Content-Type: text/plain
<
My post data
PATCH /myapp
curl -X PATCH -v -d 'My patch data' --raw -H "Content-Type: text/plain" http://localhost/myapp
> PATCH /myapp HTTP/1.1
> Host: localhost
> User-Agent: curl/7.50.1
> Accept: */*
> Content-Type: text/plain
> Content-Length: 13
>
< HTTP/1.1 200 OK
< Date: Fri, 31 May 2019 06:57:28 GMT
< Server: Apache/2.4.18 (Ubuntu)
< Connection: close
< Content-Length: 13
< Content-Type: text/plain
<
My patch data
DELETE /myapp
curl -v --raw -X DELETE http://localhost/myapp
> DELETE /myapp HTTP/1.1
> Host: localhost
> User-Agent: curl/7.50.1
> Accept: */*
>
< HTTP/1.1 204 No Content
< Date: Fri, 31 May 2019 07:00:45 GMT
< Server: Apache/2.4.18 (Ubuntu)
< Connection: close
< Content-Type: text/plain
<
SEE ALSO
AUTHOR
Serż Minus (Sergey Lepenkov) http://www.serzik.com <abalama@cpan.org>
COPYRIGHT
Copyright (C) 1998-2019 D&D Corporation. All Rights Reserved
LICENSE
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See LICENSE file and https://dev.perl.org/licenses/