commit 9cc426ecf7ca3e6378d8ee131298627a18bd6500
parent a62d563930459baae164845cc86535e87f465792
Author: Joel-Haeberli <haebu@rubigen.ch>
Date: Thu, 30 May 2024 09:19:12 +0200
chore: incoming history
Diffstat:
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/c2ec/api-wire-gateway.go b/c2ec/api-wire-gateway.go
@@ -313,6 +313,10 @@ func historyIncoming(res http.ResponseWriter, req *http.Request) {
if startPtr != nil {
start = *startPtr
}
+ } else {
+ res.Header().Add(CONTENT_TYPE_HEADER, "application/json")
+ LogWarn("wire-gateway-api", "invalid parameter")
+ return
}
var delta = 0
@@ -322,6 +326,10 @@ func historyIncoming(res http.ResponseWriter, req *http.Request) {
if deltaPtr != nil {
delta = *deltaPtr
}
+ } else {
+ res.Header().Add(CONTENT_TYPE_HEADER, "application/json")
+ LogWarn("wire-gateway-api", "invalid parameter")
+ return
}
if delta == 0 {
diff --git a/c2ec/http-util.go b/c2ec/http-util.go
@@ -46,7 +46,7 @@ func AcceptOptionalParamOrWriteResponse[T any](
if ptr == nil {
LogInfo("http", "optional parameter "+name+" was not set")
- return nil, false
+ return nil, true
}
obj := *ptr