package main

import (
	"fmt"
	"io/ioutil"
	"net/http"
	"net/url"
)

func sendToRESTAPIForm(data url.Values) error {
	fmt.Printf("REST API Endpoint: %s\n", config.RestAPIEndpoint)
	fmt.Printf("Sending data to REST API: %v\n", data)

	logInfo(fmt.Sprintf("Sending data to REST API: %v\n", data))
	resp, err := http.PostForm(config.RestAPIEndpoint, data)
	if err != nil {
		return err
	}
	defer resp.Body.Close()

	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		logError(fmt.Sprintf("Error reading body: %v\n", data))
		return err
	}

	// 결과 출력
	fmt.Printf("Response Headers: %v\n", resp.Header)
	fmt.Printf("Response Status: %s\n", resp.Status)
	fmt.Printf("Response Body: %s\n", string(body))

	return nil
}
