You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
_NOTE_: By enabling `ASYNCWEBSERVER_REGEX`, `<regex>` will be included. This will add an 100k to your binary.
85
+
86
+
See the [URIMatcher example here](https://github.com/ESP32Async/ESPAsyncWebServer/blob/master/examples/URIMatcher/URIMatcher.ino) and [URIMatcherTest example here](https://github.com/ESP32Async/ESPAsyncWebServer/blob/master/examples/URIMatcherTest/URIMatcherTest.ino).
Copy file name to clipboardExpand all lines: docs/responses.md
+39-10Lines changed: 39 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@
15
15
16
16
This will send error 400 instead of 200.
17
17
18
-
See the [example here](../examples/Replace/Replace.ino).
18
+
See the [example here](https://github.com/ESP32Async/ESPAsyncWebServer/blob/master/examples/Replace/Replace.ino).
19
19
20
20
## Request Continuation
21
21
@@ -63,7 +63,7 @@ if (auto request = requestPtr.lock()) {
63
63
}
64
64
```
65
65
66
-
See the [RequestContinuation example here](../examples/RequestContinuation/RequestContinuation.ino) and [RequestContinuationComplete example here](../examples/RequestContinuationComplete/RequestContinuationComplete.ino).
66
+
See the [RequestContinuation example here](https://github.com/ESP32Async/ESPAsyncWebServer/blob/master/examples/RequestContinuation/RequestContinuation.ino) and [RequestContinuationComplete example here](https://github.com/ESP32Async/ESPAsyncWebServer/blob/master/examples/RequestContinuationComplete/RequestContinuationComplete.ino).
67
67
68
68
## Responses
69
69
@@ -77,7 +77,7 @@ request->redirect("/login");
77
77
request->redirect("http://esp8266.com");
78
78
```
79
79
80
-
See the [Redirect example here](../examples/Redirect/Redirect.ino).
80
+
See the [Redirect example here](https://github.com/ESP32Async/ESPAsyncWebServer/blob/master/examples/Redirect/Redirect.ino).
81
81
82
82
### Basic response with HTTP Code
83
83
@@ -139,7 +139,7 @@ const char index_html[] PROGMEM = "..."; // large char array, tested with 14k
See the [ChunkResponse example here](../examples/ChunkResponse/ChunkResponse.ino).
364
+
See the [ChunkResponse example here](https://github.com/ESP32Async/ESPAsyncWebServer/blob/master/examples/ChunkResponse/ChunkResponse.ino).
365
365
366
366
### Respond with content using a callback and extra headers
367
367
@@ -507,7 +507,7 @@ response->addHeader("Server","ESP Async Web Server");
507
507
request->send(response);
508
508
```
509
509
510
-
See the [ChunkRequest example here](../examples/ChunkRequest/ChunkRequest.ino) and [ChunkRetryResponse example here](../examples/ChunkRetryResponse/ChunkRetryResponse.ino).
510
+
See the [ChunkRequest example here](https://github.com/ESP32Async/ESPAsyncWebServer/blob/master/examples/ChunkRequest/ChunkRequest.ino) and [ChunkRetryResponse example here](https://github.com/ESP32Async/ESPAsyncWebServer/blob/master/examples/ChunkRetryResponse/ChunkRetryResponse.ino).
See the [AsyncResponseStream example here](../examples/AsyncResponseStream/AsyncResponseStream.ino).
588
+
See the [AsyncResponseStream example here](https://github.com/ESP32Async/ESPAsyncWebServer/blob/master/examples/AsyncResponseStream/AsyncResponseStream.ino).
589
589
590
590
### ArduinoJson Basic Response
591
591
@@ -624,7 +624,7 @@ response->setLength();
624
624
request->send(response);
625
625
```
626
626
627
-
See the [Json example here](../examples/Json/Json.ino).
627
+
See the [Json example here](https://github.com/ESP32Async/ESPAsyncWebServer/blob/master/examples/Json/Json.ino).
628
628
629
629
### MessagePack Response
630
630
@@ -643,7 +643,36 @@ response->setLength();
643
643
request->send(response);
644
644
```
645
645
646
-
See the [MessagePack example here](../examples/MessagePack/MessagePack.ino).
646
+
See the [MessagePack example here](https://github.com/ESP32Async/ESPAsyncWebServer/blob/master/examples/MessagePack/MessagePack.ino).
647
+
648
+
## Adding Default Headers
649
+
650
+
In some cases, such as when working with CORS, or with some sort of custom authentication system,
651
+
you might need to define a header that should get added to all responses (including static, websocket and EventSource).
652
+
The DefaultHeaders singleton allows you to do this.
**IMPORTANT**: Authentication should now use `AsyncAuthenticationMiddleware` instead of the deprecated methods. See the [How to use authentication with AsyncAuthenticationMiddleware](#how-to-use-authentication-with-asyncauthenticationmiddleware) section.
142
+
**IMPORTANT**: Authentication should now use `AsyncAuthenticationMiddleware` instead of the deprecated methods. See the [How to use authentication with AsyncAuthenticationMiddleware](middleware.md#how-to-use-authentication-with-asyncauthenticationmiddleware) section.
176
143
177
144
### Setup global and class functions as request handlers
178
145
@@ -228,97 +195,3 @@ void loop() {
228
195
if ( !ws.enabled() )
229
196
ws.enable(true);
230
197
```
231
-
232
-
Example of OTA code
233
-
234
-
```cpp
235
-
// OTA callbacks
236
-
ArduinoOTA.onStart([]() {
237
-
// Clean SPIFFS
238
-
SPIFFS.end();
239
-
240
-
// Clean LittleFS
241
-
LittleFS.end();
242
-
243
-
// Disable client connections
244
-
ws.enable(false);
245
-
246
-
// Advertise connected clients what's going on
247
-
ws.textAll("OTA Update Started");
248
-
249
-
// Close them
250
-
ws.closeAll();
251
-
252
-
});
253
-
254
-
```
255
-
256
-
See the [EndBegin example here](../examples/EndBegin/EndBegin.ino).
257
-
258
-
### Adding Default Headers
259
-
260
-
In some cases, such as when working with CORS, or with some sort of custom authentication system,
261
-
you might need to define a header that should get added to all responses (including static, websocket and EventSource).
262
-
The DefaultHeaders singleton allows you to do this.
_NOTE_: By enabling `ASYNCWEBSERVER_REGEX`, `<regex>` will be included. This will add an 100k to your binary.
323
-
324
-
See the [URIMatcher example here](../examples/URIMatcher/URIMatcher.ino) and [URIMatcherTest example here](../examples/URIMatcherTest/URIMatcherTest.ino).
Copy file name to clipboardExpand all lines: docs/websockets.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,7 +40,7 @@ I recommend to use the official API `AsyncWebSocketMessageBuffer` to retain furt
40
40
The server includes a web socket plugin which lets you define different WebSocket locations to connect to
41
41
without starting another listening service or using different port
42
42
43
-
See the [WebSocket example here](../examples/WebSocket/WebSocket.ino) and [WebSocketEasy example here](../examples/WebSocketEasy/WebSocketEasy.ino).
43
+
See the [WebSocket example here](https://github.com/ESP32Async/ESPAsyncWebServer/blob/master/examples/WebSocket/WebSocket.ino) and [WebSocketEasy example here](https://github.com/ESP32Async/ESPAsyncWebServer/blob/master/examples/WebSocketEasy/WebSocketEasy.ino).
0 commit comments