package com.atlassian.bitbucket.internal.branch.web;

import java.net.URLConnection;

import static java.util.Optional.ofNullable;

public class MimeUtils {

    private MimeUtils() {
        // utility class
    }

    public static String getContentType(String resource, String defaultType) {
        String guessed = URLConnection.guessContentTypeFromName(resource);
        return ofNullable(guessed).orElse(defaultType);
    }
}
