fix delivery endpoint
All checks were successful
Build and Publish / BuildAndDeploy (push) Successful in 1m52s
All checks were successful
Build and Publish / BuildAndDeploy (push) Successful in 1m52s
This commit is contained in:
@@ -2,7 +2,6 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
@@ -85,14 +84,11 @@ type SetDelivery struct {
|
|||||||
|
|
||||||
func (s *PoolServer) HandleSetDelivery(w http.ResponseWriter, r *http.Request) error {
|
func (s *PoolServer) HandleSetDelivery(w http.ResponseWriter, r *http.Request) error {
|
||||||
id := r.PathValue("id")
|
id := r.PathValue("id")
|
||||||
var delivery *SetDelivery
|
delivery := SetDelivery{}
|
||||||
err := json.NewDecoder(r.Body).Decode(delivery)
|
err := json.NewDecoder(r.Body).Decode(&delivery)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if delivery == nil {
|
|
||||||
return fmt.Errorf("no delivery data")
|
|
||||||
}
|
|
||||||
data, err := s.pool.Process(ToCartId(id), Message{
|
data, err := s.pool.Process(ToCartId(id), Message{
|
||||||
Type: SetDeliveryType,
|
Type: SetDeliveryType,
|
||||||
Content: &messages.SetDelivery{
|
Content: &messages.SetDelivery{
|
||||||
|
|||||||
Reference in New Issue
Block a user