package main

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

func main() {

	endpoint := "http://uat-jts.jtexpress.sg/jts-service-doorstep/api/gateway/v1/merchants/getServiceTypes"
	token := "JWT eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJpc3N1ZXIiLCJleHAiOjE2NTY5MjM1NzYsImlhdCI6MTY1NjMxODc3NiwidXNlcm5hbWUiOiJqdC1zZ0Bwcm9kdWN0b24uY2xvdWQifQ.pNXzRlE7C3x67-NfuVqXNONddSD_Phcmepm1wz_6teI"

	req, err := http.NewRequest("GET", endpoint, nil)
	req.Header.Add("Authorization", token)

	//client := &http.Client{}
	//res, err := client.Do(req)
	res, err := http.DefaultClient.Do(req)
	fmt.Println(err)

	reqDump, err := httputil.DumpRequestOut(req, true)
	fmt.Println(string(reqDump), err)

	body, err := ioutil.ReadAll(res.Body)
	fmt.Println(string(body), err)

	respDump, err := httputil.DumpResponse(res, true)
	if err != nil {
		fmt.Println(err)
	}

	fmt.Printf(string(respDump))
}
