From c554a05b60909686d460432edc7f24326800aacc Mon Sep 17 00:00:00 2001 From: nyne Date: Sat, 22 Nov 2025 20:54:49 +0800 Subject: [PATCH] feat: include status code in proxy response --- server/api/proxy.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/api/proxy.go b/server/api/proxy.go index 20c17bf..0100674 100644 --- a/server/api/proxy.go +++ b/server/api/proxy.go @@ -24,6 +24,7 @@ var ( type proxyResponse struct { Content string `json:"content"` ContentType string `json:"content_type"` + StatusCode int `json:"status_code"` } func init() { @@ -83,8 +84,9 @@ func handleProxyCall(c fiber.Ctx) error { } } + c.Status(resp.StatusCode) c.Response().Header.SetContentType(resp.ContentType) - return c.Send([]byte(rawVal)) + return c.SendString(resp.Content) } func proxy(uri *url.URL) (*proxyResponse, error) { @@ -106,6 +108,7 @@ func proxy(uri *url.URL) (*proxyResponse, error) { proxyResp := &proxyResponse{ Content: string(data), ContentType: contentType, + StatusCode: resp.StatusCode, } j, err := json.Marshal(proxyResp)