add request->redirect(url)

This commit is contained in:
Me No Dev 2016-06-26 16:20:21 +03:00
parent b5ba7f542c
commit e5a6999582
2 changed files with 8 additions and 0 deletions

View File

@ -195,6 +195,8 @@ class AsyncWebServerRequest {
void setHandler(AsyncWebHandler *handler){ _handler = handler; }
void addInterestingHeader(String name);
void redirect(String url);
void send(AsyncWebServerResponse *response);
void send(int code, String contentType=String(), String content=String());
void send(FS &fs, String path, String contentType=String(), bool download=false);

View File

@ -694,6 +694,12 @@ void AsyncWebServerRequest::sendChunked(String contentType, AwsResponseFiller ca
send(beginChunkedResponse(contentType, callback));
}
void AsyncWebServerRequest::redirect(String url){
AsyncWebServerResponse * response = beginResponse(302);
response->addHeader("Location",url);
send(response);
}
bool AsyncWebServerRequest::authenticate(const char * username, const char * password){
if(_authorization.length()){