Skip to content

Commit 40ffb03

Browse files
committed
Fix invalid string creation for file size fhessel#37
1 parent 08d7df1 commit 40ffb03

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

examples/REST-API/REST-API.ino

+2-1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ char contentTypes[][2][32] = {
7676
#include <SSLCert.hpp>
7777
#include <HTTPRequest.hpp>
7878
#include <HTTPResponse.hpp>
79+
#include <util.hpp>
7980

8081
// We use the following struct to store GPIO events:
8182
#define MAX_EVENTS 20
@@ -316,7 +317,7 @@ void handleSPIFFS(HTTPRequest * req, HTTPResponse * res) {
316317
File file = SPIFFS.open(filename.c_str());
317318

318319
// Set length
319-
res->setHeader("Content-Length", "" + file.size());
320+
res->setHeader("Content-Length", httpsserver::intToString(file.size()));
320321

321322
// Content-Type is guessed using the definition of the contentTypes-table defined above
322323
int cTypeIdx = 0;

0 commit comments

Comments
 (0)