const jsonData = JSON.stringify({ test: "test" });
const formData = new FormData();
const blob = new Blob([jsonData], { type: "application/json" });
formData.append("file", blob, "data.json");
const apiUrl = "https://filehaus.top/api/upload/data.json";
try {
const response = await fetch(apiUrl, {
method: "POST",
body: formData,
headers: {
},
});
const result = await response.text();
console.log(response.headers);
console.log("Response:", result);
} catch (error) {
console.error("Error:", error.message);
}