Skip to main content

HTTPRedirect

What Is This Enum?

A string enum representing Fetch API RequestInit.redirect values. It configures how redirect responses from the server are handled.

Values

NameValueDescription
FOLLOW'follow'Automatically follows redirects.
ERROR'error'Treats a redirect response as an error.
MANUAL'manual'Does not automatically follow redirects.

Example

import { dench, HTTPRedirect } from 'dench-fetch';

const response = await dench('https://api.example.com')
.get('/redirected-resource')
.redirect(HTTPRedirect.MANUAL)
.toResponse();

// RequestInit: { method: 'GET', redirect: 'manual' }