Apache AWF
  1. Apache AWF
  2. AWF-179

Add redirect method to HttpResponse

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Trivial Trivial
    • Resolution: Unresolved
    • Labels:
      None

      Description

      Convenience method
      from facebook/tornado

      def redirect(self, url, permanent=False):
      """Sends a redirect to the given (optionally relative) URL."""
      if self._headers_written:
      raise Exception("Cannot redirect after headers have been written")
      self.set_status(301 if permanent else 302)

      1. Remove whitespace
        url = re.sub(r"[\x00-\x20]+", "", _utf8(url))
        self.set_header("Location", urlparse.urljoin(self.request.uri, url))
        self.finish()

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            Unassigned
            Reporter:
            Niklas Gustavsson
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Development