package real

import (
	"fmt"
	"net/http"
	"net/http/httputil"
	"time"
)

type Retriever struct {
	UserAgent string
	TimeOut   time.Duration
}

func (r *Retriever) String() string {
	return fmt.Sprintf(
		"contents=%s", r.UserAgent,
	)
}

func (r *Retriever) Post(url string, form map[string]string) string {
	r.UserAgent = form["contents"]
	return "ok"
}

func (r *Retriever) Get(url string) string {

	resp, err := http.Get(url)
	if err != nil {
		panic(err)
	}

	result, err := httputil.DumpResponse(resp, true)
	resp.Body.Close()
	if err != nil {
		panic(err)
	}
	return string(result)
}
