(refactor) simplified content_type retrieval

This commit changes the content_type retrieval
to use the built in method `extension` that is
provided on the Path.

It also adds a test.