Skip to content

Commit

Permalink
If content type cannot be determined from path, then try uri.
Browse files Browse the repository at this point in the history
This is useful for minified files (eg. path file.min.js, file file.js).
  • Loading branch information
psychogony committed May 6, 2017
1 parent 9bc1ae5 commit 590293e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions libraries/ESP8266WebServer/src/detail/RequestHandlersImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@ class StaticRequestHandler : public RequestHandler {

String contentType = getContentType(path);

// If content type not matched on path, then try for uri
// Useful for minified javascript et al.
if (contentType.equals("application/octet-stream"))
{
contentType = getContentType(requestUri);
}

// look for gz file, only if the original specified path is not a gz. So part only works to send gzip via content encoding when a non compressed is asked for
// if you point the the path to gzip you will serve the gzip as content type "application/x-gzip", not text or javascript etc...
if (!path.endsWith(".gz") && !_fs.exists(path)) {
Expand Down

0 comments on commit 590293e

Please sign in to comment.