Skip to content

Commit

Permalink
cache menu
Browse files Browse the repository at this point in the history
  • Loading branch information
tve committed Jun 27, 2015
1 parent f8cd9ff commit 3e44347
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion user/cgi.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,12 @@ extern char *esp_link_version; // in user_main.c

int ICACHE_FLASH_ATTR cgiMenu(HttpdConnData *connData) {
char buff[1024];
jsonHeader(connData, 200);
// don't use jsonHeader so the response does get cached
httpdStartResponse(connData, 200);
httpdHeader(connData, "Cache-Control", "max-age=3600, must-revalidate");
httpdHeader(connData, "Content-Type", "application/json");
httpdEndHeaders(connData);
// construct json response
os_sprintf(buff,
"{\"menu\": [\"Home\", \"/home.html\", \"Wifi\", \"/wifi/wifi.html\","
"\"\xC2\xB5" "C Console\", \"/console.html\", \"Debug log\", \"/log.html\" ],\n"
Expand Down

0 comments on commit 3e44347

Please sign in to comment.