<commit_before>package com.namelessmc.NamelessAPI.utils;

import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;

import javax.net.ssl.HttpsURLConnection;

import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.namelessmc.NamelessAPI.NamelessException;

public class NamelessRequestUtil {

	/**
	 * @param url Full URL with / at the end
	 * @param postString
	 * @param https
	 * @return
	 */
	public static Request sendPostRequest(URL baseUrl, String action, String postString) {

		if (baseUrl == null) {
			throw new IllegalArgumentException("URL must not be null");
		}
			
		if (postString == null) {
			throw new IllegalArgumentException("Post string must not be null");
		}
		
		String baseUrlString = appendCharacter(baseUrl.toString(), '/');
		
		URL url;
		
		try {
			url = new URL(baseUrlString + action);
		} catch (MalformedURLException e1) {
			throw new IllegalArgumentException("URL or action is malformed (" + e1.getMessage() + ")");
		}
			
		Exception exception;
		JsonObject response;
		try {
			URLConnection connection;
			
			boolean https = url.toString().startsWith("https");
				
			if (https) {
				HttpsURLConnection httpsConnection = (HttpsURLConnection) url.openConnection();
					
				httpsConnection.setRequestMethod("POST");<commit_msg>Set post string to "" if it is null<commit_after>package com.namelessmc.NamelessAPI.utils;

import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;

import javax.net.ssl.HttpsURLConnection;

import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.namelessmc.NamelessAPI.NamelessException;

public class NamelessRequestUtil {

	/**
	 * @param url Full URL with / at the end
	 * @param postString
	 * @param https
	 * @return
	 */
	public static Request sendPostRequest(URL baseUrl, String action, String postString) {

		if (baseUrl == null) {
			throw new IllegalArgumentException("URL must not be null");
		}
			
		if (postString == null) {
			postString = "";
		}
		
		String baseUrlString = appendCharacter(baseUrl.toString(), '/');
		
		URL url;
		
		try {
			url = new URL(baseUrlString + action);
		} catch (MalformedURLException e1) {
			throw new IllegalArgumentException("URL or action is malformed (" + e1.getMessage() + ")");
		}
			
		Exception exception;
		JsonObject response;
		try {
			URLConnection connection;
			
			boolean https = url.toString().startsWith("https");
				
			if (https) {
				HttpsURLConnection httpsConnection = (HttpsURLConnection) url.openConnection();
					
				httpsConnection.setRequestMethod("POST");
{'fraction_non_alphanumeric': 0.10585052417991207, 'fraction_numerical': 0.0013527223537368955, 'mean_word_length': 4.171328671328672, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4228843', 'n_tokens_mistral': 989, 'n_tokens_neox': 860, 'n_words': 219}