(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.
Conventionally this would be either `"text".to_string()`, or preferably `assert_eq!(content_type.type_.as_slice(), "text");`. (And below too.)