Created
August 4, 2020 05:24
-
-
Save aavrug/ff970ffc016c0b7377d8661a01da9185 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func requestHandler(w http.ResponseWriter, r *http.Request) { | |
if r.Method == http.MethodGet { | |
resp := sendRequest(w, r) | |
fmt.Println(resp) | |
fmt.Println(reflect.TypeOf(resp)) | |
var dat map[string]interface{} | |
if err := json.Unmarshal(resp, &dat); err != nil { | |
panic(err) | |
} | |
fmt.Println(dat) | |
return dat | |
// fmt.Fprintf(w, "Success") | |
// response, err := json.Marshal(resp) | |
// if err != nil { | |
// fmt.Println(err) | |
// } | |
// w.Header().Set("Content-Type", "application/json; charset=utf-8") | |
// w.WriteHeader(http.StatusOK) | |
// w.Write(response) | |
// fmt.Fprintf(w, response) | |
// fmt.Println("This is a get request") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment