This is the way it's done inside NanoHTTPD, hence why I did it this way around.