fix(go-http): requires content-type set to application/json

Signed-off-by: guergabo <guergabo@umich.edu>
This commit is contained in:
guergabo 2023-06-14 14:33:15 -05:00
parent bb3fb88677
commit b830b8dda5
2 changed files with 3 additions and 0 deletions

View File

@ -34,6 +34,8 @@ func main() {
log.Fatal(err.Error())
}
req.Header.Set("Content-Type", "application/json")
// Publish an event using Dapr pub/sub
res, err := client.Do(req)
if err != nil {

View File

@ -45,6 +45,7 @@ func postOrder(w http.ResponseWriter, r *http.Request) {
log.Fatal(err)
}
var result Result
fmt.Println(string(data))
err = json.Unmarshal(data, &result)
if err != nil {
log.Fatal(err.Error())