/[jscoverage]/trunk/tests/POSTServer.py
ViewVC logotype

Contents of /trunk/tests/POSTServer.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 114 - (show annotations)
Sat May 31 21:39:39 2008 UTC (11 years ago) by siliconforks
File MIME type: text/x-python
File size: 1490 byte(s)
Add tests for jscoverage-server.

1 # POSTServer.py - HTTP POST server for testing jscoverage-server --proxy
2 # Copyright (C) 2008 siliconforks.com
3 #
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License along
15 # with this program; if not, write to the Free Software Foundation, Inc.,
16 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
18
19 import BaseHTTPServer
20 import SimpleHTTPServer
21 import os
22
23
24 class POSTServer(SimpleHTTPServer.SimpleHTTPRequestHandler):
25 def do_POST(self):
26 header = self.headers.getheader('content-length')
27 if header is not None:
28 length = int(header)
29 postdata = self.rfile.read(length)
30 self.send_response(200);
31 self.send_header("Content-type", "text/html")
32 self.end_headers()
33 if header is not None:
34 self.wfile.write(postdata);
35
36
37 def test(HandlerClass = POSTServer,
38 ServerClass = BaseHTTPServer.HTTPServer):
39 BaseHTTPServer.test(HandlerClass, ServerClass)
40
41
42 if __name__ == '__main__':
43 test()

  ViewVC Help
Powered by ViewVC 1.1.24