我收到一个函数返回的 rest.Response 并希望使用两个返回字段将自定义数据发送到另一个服务。var reply email.SendTemplateResponseBody response, err := s.DynamicTemplateEmail(request) if err != nil { reply = email.SendTemplateResponseBody{ Status: int32(response.StatusCode), Message: "It didn't work", } } else { reply = email.SendTemplateResponseBody{ Status: int32(response.StatusCode), Message: "It worked!", } }我在字段上使用验证,所以想从正文中获取返回的错误并在上面的代码中使用它。响应':{StatusCode:400 Body:{"errors":[{"message":"The from object must be provided for every email send. It is an object that requires the email parameter, but may also contain a name parameter. e.g. {\"email\" : \"example@example.com\"} 这可以在不解组的情况下完成吗?如果是这样,这是正确的方法吗?
- 1 回答
- 0 关注
- 92 浏览
添加回答
举报
0/150
提交
取消