jefflau/jest-fetch-mock

Mock Request.redirect()

markjaquith opened this issue · 1 comments

Request.redirect() isn't currently mocked.

https://developer.mozilla.org/en-US/docs/Web/API/Response/redirect

I'm currently using this:

Response.redirect = (url: string, status: number = 302) =>
	new Response(null, {
		headers: {
			Location: url,
		},
		status,
	}
);

Agreed, I think it's worth adding this if you wanted to submit a PR