Working
This commit is contained in:
@@ -7,7 +7,7 @@ import (
|
|||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
type SnapshotListResponse struct {
|
type SnapshotPayload struct {
|
||||||
Snapshots []*SnapshotRecord `json:"snapshots"`
|
Snapshots []*SnapshotRecord `json:"snapshots"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,7 +41,7 @@ func createSnapshotSubFromJsonBodyStream(jsonBodyStream io.ReadCloser) (*Snapsho
|
|||||||
}
|
}
|
||||||
|
|
||||||
func createJsonFromSnapshotRecords(records []*SnapshotRecord) ([]byte, error) {
|
func createJsonFromSnapshotRecords(records []*SnapshotRecord) ([]byte, error) {
|
||||||
jsonResult, err := json.Marshal(SnapshotListResponse{records})
|
jsonResult, err := json.Marshal(SnapshotPayload{records})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ func sendData(w http.ResponseWriter, r *http.Request) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("couldn't create a json from the records: %w", err)
|
return fmt.Errorf("couldn't create a json from the records: %w", err)
|
||||||
}
|
}
|
||||||
|
w.Header().Set("Content-Type", "application/json")
|
||||||
_, err = fmt.Fprintf(w, string(json))
|
_, err = fmt.Fprintf(w, string(json))
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user