package com.atlassian.bitbucket.internal.mirroring.jwt;

import com.atlassian.jwt.httpclient.CanonicalHttpUriRequest;
import com.google.common.collect.Maps;

import java.util.List;
import java.util.Map;

public class HttpUriRequestHelper {

    /**
     * Convert URL query parameters to be passed to {@link CanonicalHttpUriRequest}
     * @param value the URL query parameters
     * @return a map of url query parameters correctly formatted for {@link CanonicalHttpUriRequest}
     */
    public static Map<String, String[]> convertParameters(Map<String, List<String>> value) {
        return value == null ? Maps.<String, String[]>newHashMap() : Maps.transformEntries(value,
                (key, value1) -> value1.toArray(new String[value1.size()]));
    }
}
