Chat freely about anything...

User avatar
By hiddenvision
#73872 Hi All,
Sorry for perhaps a Dumb question, but hey hoe, here we go.

I noticed in my compiled Bin file a few chunks of text that would be handy to access.

Mostly I refer to the GetContentType(path){} function using mimeTypes[]

I searched around and find most people create their own, much like I also did.
But looking thru the Bin I see the Ext's and Types sitting there. (IN DUPLICATE)

So something is pulling these in from "RequestHandlersimpl.h"

Code: Select all// Table of extension->MIME strings stored in PROGMEM, needs to be global due to GCC section typing rules
static const struct {const char endsWith[16]; const char mimeType[32];} mimeTable[] ICACHE_RODATA_ATTR = {
    { ".html", "text/html" },
............
};


They are used by the
Code: Select allstatic String getContentType(const String& path) {
........
  return String(buff);
}


I have tried many different approaches to call getContentType, ALL WRONG.
Keep getting the function not found....error

But I figure the function must be somewhere tucked behind some dot.

I guess this function may or may not be available, depending on build, imports and other options.

Can anyone shed a light on how to call this within a bit of "user" code.
It's gonna be so simple, or Impossible.

Perhaps also a method of checking if it has been imported.
At a guess a test of this would see if the .h has been loaded.
#ifdef REQUESTHANDLERSIMPL_H


I am being totally lazy and using the Arduino IDE if that makes a difference.!


Hv.