MCPcopy Create free account
hub / github.com/SmingHub/Sming / onFile

Function onFile

samples/HttpServer_FirmwareUpload/app/application.cpp:16–25  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14HttpServer server;
15
16void onFile(HttpRequest& request, HttpResponse& response)
17{
18 String file = request.uri.getRelativePath();
19 if(file.length() == 0) {
20 file = "index.html";
21 }
22
23 response.setCache(86400, true); // It's important to use cache for better performance.
24 response.sendFile(file);
25}
26
27int onUpload(HttpServerConnection& connection, HttpRequest& request, HttpResponse& response)
28{

Callers

nothing calls this directly

Calls 4

getRelativePathMethod · 0.80
setCacheMethod · 0.80
lengthMethod · 0.45
sendFileMethod · 0.45

Tested by

no test coverage detected