forked from peritus/robotframework-httplibrary
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace httpstat.us with local mock server
- Loading branch information
Showing
2 changed files
with
62 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/usr/bin/env python | ||
|
||
import BaseHTTPServer | ||
|
||
class WebRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): | ||
def do_GET(self): | ||
if self.path == '/200': | ||
self.send_response(200, "OK") | ||
elif self.path == '/302': | ||
self.send_response(302, "Redirect") | ||
self.send_header('Location', '/200') | ||
self.end_headers() | ||
elif self.path == '/404': | ||
self.send_response(404, "Not Found") | ||
elif self.path == '/418': | ||
self.send_response(418, "I'm a teapot") | ||
elif self.path == '/503': | ||
self.send_response(503, "Some error") | ||
else: | ||
self.send_error(500) | ||
|
||
server = BaseHTTPServer.HTTPServer(('localhost', 36503), WebRequestHandler) | ||
server.serve_forever() | ||
|
||
print 'Listening on http://localhost:36503/' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters