From 19fadd75b3cc4d62f3d449badeb37e816c5494f0 Mon Sep 17 00:00:00 2001 From: Arunesh Dwivedi Date: Sat, 27 Jun 2026 03:26:57 +0000 Subject: [PATCH] fix(deviceshifuhttp): forward upstream status code in GET/POST handler Go's net/http implicitly writes 200 OK when the ResponseWriter is written to without a prior WriteHeader call. The GET/POST instruction handler copied the response body but never called WriteHeader with the upstream status code, so non-2xx responses (e.g. 500 from a failed device probe) were silently translated to 200 OK. Adds w.WriteHeader(resp.StatusCode) before io.Copy, matching the pattern already used by the HTTPCommandline handler in the same file. Signed-off-by: Arunesh Dwivedi --- pkg/deviceshifu/deviceshifuhttp/deviceshifuhttp.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/deviceshifu/deviceshifuhttp/deviceshifuhttp.go b/pkg/deviceshifu/deviceshifuhttp/deviceshifuhttp.go index efd3262ca..d97feb094 100644 --- a/pkg/deviceshifu/deviceshifuhttp/deviceshifuhttp.go +++ b/pkg/deviceshifu/deviceshifuhttp/deviceshifuhttp.go @@ -215,6 +215,7 @@ func (handler DeviceCommandHandlerHTTP) commandHandleFunc() http.HandlerFunc { instructionFuncName, shouldUsePythonCustomProcessing := deviceshifubase.CustomInstructionsPython[handlerInstruction] if !shouldUsePythonCustomProcessing { utils.CopyHeader(w.Header(), resp.Header) + w.WriteHeader(resp.StatusCode) _, err := io.Copy(w, resp.Body) if err != nil { logger.Errorf("cannot copy requestBody from requestBody, error: %s", err.Error())