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

Function onFile

samples/HttpServer_AJAX/app/application.cpp:33–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31}
32
33void onFile(HttpRequest& request, HttpResponse& response)
34{
35 String file = request.uri.getRelativePath();
36
37 if(file[0] == '.')
38 response.code = HTTP_STATUS_FORBIDDEN;
39 else {
40 response.setCache(86400, true); // It's important to use cache for better performance.
41 response.sendFile(file);
42 }
43}
44
45void onAjaxInput(HttpRequest& request, HttpResponse& response)
46{

Callers

nothing calls this directly

Calls 3

getRelativePathMethod · 0.80
setCacheMethod · 0.80
sendFileMethod · 0.45

Tested by

no test coverage detected