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

Function onFile

samples/Basic_WebSkeletonApp_LTS/app/webserver.cpp:66–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64 response.sendDataStream(stream, MIME_JSON);
65}
66void onFile(HttpRequest& request, HttpResponse& response)
67{
68 String file = request.uri.getRelativePath();
69
70 if(file[0] == '.')
71 response.code = HTTP_STATUS_FORBIDDEN;
72 else {
73 response.setCache(86400, true); // It's important to use cache for better performance.
74 response.sendFile(file);
75 }
76}
77
78void onAjaxGetState(HttpRequest& request, HttpResponse& response)
79{

Callers

nothing calls this directly

Calls 3

getRelativePathMethod · 0.80
setCacheMethod · 0.80
sendFileMethod · 0.45

Tested by

no test coverage detected