Last active
February 18, 2020 10:49
-
-
Save bykof/903a37b9276887c16641f884ba950218 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
package infrastructure | |
import ( | |
"dashboard/order/domain/entity" | |
"encoding/json" | |
"fmt" | |
"net/http" | |
) | |
type OrderService struct{} | |
func (orderService OrderService) GetOrder(id string) (entity.Order, error) { | |
var order entity.Order | |
response, err := http.Get(fmt.Sprintf("order-service/orders/%s", id)) | |
if err != nil { | |
return order, err | |
} | |
defer response.Body.Close() | |
err = json.NewDecoder(response.Body).Decode(&order) | |
if err != nil { | |
return order, err | |
} | |
return order, err | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment