Skip to main content
Module

x/oak/mod.ts>Response#redirect

A middleware framework for handling HTTP with Deno 🐿️ 🦕
Extremely Popular
Go to Latest
method Response.prototype.redirect
import { Response } from "https://deno.land/x/oak@v10.6.0/mod.ts";

Sets the response to redirect to the supplied url.

If the .status is not currently a redirect status, the status will be set to 302 Found.

The body will be set to a message indicating the redirection is occurring.

Parameters

url: string | URL

Sets the response to redirect back to the referrer if available, with an optional alt URL if there is no referrer header on the request. If there is no referrer header, nor an alt parameter, the redirect is set to /.

If the .status is not currently a redirect status, the status will be set to 302 Found.

The body will be set to a message indicating the redirection is occurring.

Parameters

url: REDIRECT_BACK
optional
alt: string | URL