Skip to content

Commit 02d4d1d

Browse files
authored
Merge pull request #414 from pixlise/feature/em-import-fixes
Feature/em import fixes
2 parents 91d8183 + 6b0a7e1 commit 02d4d1d

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

api/endpoints/memoisation.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ func PutMemoise(params apiRouter.ApiHandlerGenericParams) error {
140140

141141
params.Writer.Header().Add("Content-Type", "application/json")
142142

143-
ts := fmt.Sprintf("%v", timestamp)
143+
ts := fmt.Sprintf(`{"timestamp": %v}`, timestamp)
144144
params.Writer.Write([]byte(ts))
145145

146146
return nil

internal/cmd-line-tools/api-integration-test/testMemoisation.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"fmt"
77
"log"
88
"strconv"
9+
"strings"
910
"time"
1011

1112
"github.com/pixlise/core/v4/core/utils"
@@ -96,7 +97,11 @@ func testMemoisationWrite_WriteReadRead(apiHost string, jwt string) {
9697
failIf(status != 200, fmt.Errorf("Unexpected memoisation response! Status %v, body: %v", status, string(body)))
9798

9899
// We should have a time stamp
99-
ts, err := strconv.ParseInt(string(body), 10, 32)
100+
bodyStr := string(body)
101+
start := "{\"timestamp\": "
102+
failIf(!strings.HasPrefix(bodyStr, start), errors.New("Bad memoise PUT body format: "+bodyStr))
103+
104+
ts, err := strconv.ParseInt(bodyStr[len(start):len(bodyStr)-1], 10, 32)
100105
failIf(err != nil, err)
101106

102107
failIf(ts < 1742956321, fmt.Errorf("Invalid timestamp: %v", ts))

0 commit comments

Comments
 (0)