mirror of
https://github.com/me-no-dev/ESPAsyncWebServer.git
synced 2026-01-28 09:42:18 +01:00
add optional responce code to AsyncWebServerRequest::redirect() method
Allows to specify differents redirect codes to use, i.e. 301/302, 307/308
This commit is contained in:
@@ -766,8 +766,8 @@ void AsyncWebServerRequest::send(AsyncWebServerResponse* response) {
|
||||
send(500);
|
||||
}
|
||||
|
||||
void AsyncWebServerRequest::redirect(const char* url) {
|
||||
AsyncWebServerResponse* response = beginResponse(302);
|
||||
void AsyncWebServerRequest::redirect(const char* url, int code) {
|
||||
AsyncWebServerResponse* response = beginResponse(code);
|
||||
response->addHeader(T_LOCATION, url);
|
||||
send(response);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user