My browser is sending application/octet-stream.
But on the server side I have a correct Content-Type header mime value.
After some tests I concluded it is based on the file extension like .txt or .pdf.
Where is the mapping done usually, does it rely on the operating system for this ? How should servers behave ?
For Java I found this: https://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#probeContentType%28java.nio.file.Path%29
If the file is recognized then the content type is returned. If the file is not recognized by any of the installed file type detectors then a system-default file type detector is invoked to guess the content type.