3 * Copyright (C)2007-2008 Versabanq Innovations Inc. and contributors.
4 * See the included file named LICENSE for license information.
12 public class WvHttpTests
14 [Test
] [Category("http")]
15 public void http_request_tests()
17 string path
= "/testuri";
18 string query
= "parm1=1&parm2=2";
19 string request
= String
.Format("{0}?{1}", path
, query
);
20 WvHttpRequest t
= new WvHttpRequest(request
);
22 WVPASSEQ(t
.request_uri
, request
);
23 WVPASSEQ(t
.path
, path
);
24 WVPASSEQ(t
.query_string
, query
);
25 WVPASS(t
.request_method
== Wv
.Web
.Cgi
.Method
.Get
);
27 t
.parse_header("Test-Header: asdf");
28 WVPASSEQ(t
.headers
["test-header"], "asdf");
31 [Test
] [Category("http")]
32 public void http_cgi_request_tests()
34 string path
= "/testuri";
35 string query
= "parm1=1&parm2=2";
36 string request
= String
.Format("{0}?{1}", path
, query
);
37 Environment
.SetEnvironmentVariable("SCRIPT_NAME", path
);
38 Environment
.SetEnvironmentVariable("QUERY_STRING", query
);
39 Environment
.SetEnvironmentVariable("REQUEST_URI", request
);
40 Environment
.SetEnvironmentVariable("HTTP_USER_AGENT", "asdf");
41 Environment
.SetEnvironmentVariable("REQUEST_METHOD", "GET");
42 WvHttpCgiRequest t
= new WvHttpCgiRequest();
44 WVPASSEQ(t
.request_uri
, request
);
45 WVPASS(t
.request_method
== Wv
.Web
.Cgi
.Method
.Get
);
46 WVPASSEQ(t
.path
, path
);
47 WVPASSEQ(t
.query_string
, query
);
48 WVPASSEQ(t
.headers
["user-agent"], "asdf");