(self, *path_args)
| 494 | |
| 495 | class EchoHandler(RequestHandler): |
| 496 | def get(self, *path_args): |
| 497 | # Type checks: web.py interfaces convert argument values to |
| 498 | # unicode strings (by default, but see also decode_argument). |
| 499 | # In httpserver.py (i.e. self.request.arguments), they're left |
| 500 | # as bytes. Keys are always native strings. |
| 501 | for key in self.request.arguments: |
| 502 | if type(key) != str: |
| 503 | raise Exception("incorrect type for key: %r" % type(key)) |
| 504 | for bvalue in self.request.arguments[key]: |
| 505 | if type(bvalue) != bytes: |
| 506 | raise Exception("incorrect type for value: %r" % type(bvalue)) |
| 507 | for svalue in self.get_arguments(key): |
| 508 | if type(svalue) != unicode_type: |
| 509 | raise Exception("incorrect type for value: %r" % type(svalue)) |
| 510 | for arg in path_args: |
| 511 | if type(arg) != unicode_type: |
| 512 | raise Exception("incorrect type for path arg: %r" % type(arg)) |
| 513 | self.write( |
| 514 | dict( |
| 515 | path=self.request.path, |
| 516 | path_args=path_args, |
| 517 | args=recursive_unicode(self.request.arguments), |
| 518 | ) |
| 519 | ) |
| 520 | |
| 521 | |
| 522 | class RequestEncodingTest(WebTestCase): |
no test coverage detected