diff --git a/batch/types.go b/batch/types.go index c3a4cf8..9d97f6e 100644 --- a/batch/types.go +++ b/batch/types.go @@ -1,8 +1,6 @@ package batch -import ( - "time" -) +import "time" type Request struct { Operation string `json:"operation"` @@ -27,7 +25,6 @@ type ErrorResponse struct { RequestID string `json:"request_id,omitempty"` } -// Action.objects.actions.header type Action struct { HRef string `json:"href"` Header map[string]string `json:"header,omitempty"` diff --git a/server/server.go b/server/server.go index 01e61b4..eeb0168 100644 --- a/server/server.go +++ b/server/server.go @@ -79,17 +79,18 @@ func New(o Options) (http.Handler, error) { client, err := obs.New(o.AccessKeyID, o.SecretAccessKey, o.Endpoint, obs.WithSignature(obs.SignatureObs)) if err != nil { - fmt.Printf("Create obsClient error, errMsg: %s", err.Error()) + return nil, err } s := &server{ + ttl: o.TTL, client: client, bucket: o.Bucket, prefix: o.Prefix, - ttl: o.TTL, cdnDomain: o.CdnDomain, isAuthorized: o.IsAuthorized, } + r := chi.NewRouter() r.Get("/", s.healthCheck) @@ -249,6 +250,7 @@ func (s *server) handleBatch(w http.ResponseWriter, r *http.Request) { } } } + must(json.NewEncoder(w).Encode(resp)) }