Skip to main content
Module

x/drash/tests/deps.ts>Drash.Resource#redirect

A microframework for Deno's HTTP server with zero third-party dependencies
Go to Latest
method Drash.Resource.prototype.redirect
import { Drash } from "https://deno.land/x/drash@v2.7.0/tests/deps.ts";
const { Resource } = Drash;

Redirect the incoming request to another resource

Examples

Example 1

this.redirect("http://localhost/login", response);
this.redirect("http://localhost/login", response, 301);
this.redirect("http://localhost/login", response, 301, {"some-header": "some value"});

Parameters

location: string
  • The location or resource uri of where you want to redirect the request to
response: Drash.Response
  • The response object, to set the related headers and status code on
optional
status = [UNSUPPORTED]
  • (optional) The response status. Defaults to 302.
optional
headers: Drash.Types.HttpHeadersKeyValuePairs = [UNSUPPORTED]
  • (optional) Any extra headers to specify with the response. Defaults to an empty object.