I have downloaded newest NanoHTTPD from link: https://raw.githubusercontent.com/NanoHttpd/nanohttpd/master/core/src/main/java/fi/iki/elonen/NanoHTTPD.java
When processing very basic POST example, calling session.getParms() returns empty map. My code is:
@Override
public Response serve(IHTTPSession session) {
System.out.println( session.getMethod() + " " + session.getParms() );
return newFixedLengthResponse("Some response.");
}
Which returns:
{}
HTML code triggering nanoHTTPD is:
<html>
<body>
<form action="http://localhost:3388" method="POST">
<input type="text" name="username" value="a" />
<input type="submit" />
</form>
</body>
</html>
That all looks good. Do you see anything suspicious in my code, or just nanoHTTPD is not mature enough?
session.parseBody() only needed if you upload one or more files. Your codes are fine except you must provide enctype="multipart/form-data" in your html form tag. So your html code should be: