swifter icon indicating copy to clipboard operation
swifter copied to clipboard

Add "302 Found" HTTP response

Open DominikPalo opened this issue 4 years ago • 0 comments

The "302 Found HTTP" response is a common way of performing URL redirection. We use the swifter framework in our projects for creating a local webserver handling OAuth2 flow and the 302 Found HTTP response is a recommended way for redirecting to the OAuth2 success pages.

I created this PR to make things easier, so instead of writing

server[self.callbackPath] = { _ in
	return .raw(302, "Found", ["Location": authSuccessUri], nil)
}

we could just write

server[self.callbackPath] = { _ in
	return .found(authSuccessUri)
}

DominikPalo avatar Oct 12 '21 09:10 DominikPalo