forked from me-no-dev/ESPAsyncWebServer
-
Notifications
You must be signed in to change notification settings - Fork 102
Expand file tree
/
Copy pathWebDAVMethods.ino
More file actions
65 lines (52 loc) · 1.51 KB
/
Copy pathWebDAVMethods.ino
File metadata and controls
65 lines (52 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// SPDX-License-Identifier: LGPL-3.0-or-later
// Copyright 2016-2026 Hristo Gochkov, Mathieu Carbou, Emil Muratov, Mitch Bradley
//
// - Test for additional WebDAV request methods
//
#include <Arduino.h>
#if defined(ESP32) || defined(LIBRETINY)
#include <AsyncTCP.h>
#include <WiFi.h>
#elif defined(ESP8266)
#include <ESP8266WiFi.h>
#include <ESPAsyncTCP.h>
#elif defined(TARGET_RP2040) || defined(TARGET_RP2350) || defined(PICO_RP2040) || defined(PICO_RP2350)
#include <RPAsyncTCP.h>
#include <WiFi.h>
#endif
#include <ESPAsyncWebServer.h>
using namespace asyncsrv;
// Tests:
//
// Send requests with various methods
// curl -s -X PROPFIND http://192.168.4.1/
// curl -s -X LOCK http://192.168.4.1/
// curl -s -X UNLOCK http://192.168.4.1/
// curl -s -X PROPPATCH http://192.168.4.1/
// curl -s -X MKCOL http://192.168.4.1/
// curl -s -X MOVE http://192.168.4.1/
// curl -s -X COPY http://192.168.4.1/
//
// In all cases, the request will be accepted with text/plain response 200 like
// "Got method PROPFIND on URL /"
static AsyncWebServer server(80);
void setup() {
Serial.begin(115200);
#if ASYNCWEBSERVER_WIFI_SUPPORTED
WiFi.mode(WIFI_AP);
WiFi.softAP("esp-captive");
#endif
server.onNotFound([](AsyncWebServerRequest *request) {
String resp("Got method ");
resp += request->methodToString();
resp += " on URL ";
resp += request->url();
resp += "\r\n";
Serial.print(resp);
request->send(200, "text/plain", resp.c_str());
});
server.begin();
}
void loop() {
delay(100);
}