mirror of
https://github.com/fatedier/frp.git
synced 2026-05-15 08:05:49 -06:00
[PR #5243] [CLOSED] fix: dashboard 'Clear Offline' fails with JSON parse error #5202
Labels
No labels
In Progress
WIP
WaitingForInfo
bug
doc
duplicate
easy
enhancement
future
help wanted
invalid
lifecycle/stale
need-issue-template
need-usage-help
no plan
proposal
pull-request
question
todo
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/frp#5202
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/fatedier/frp/pull/5243
Author: @mango766
Created: 3/17/2026
Status: ❌ Closed
Base:
dev← Head:fix/clear-offline-proxies-empty-json-response📝 Commits (1)
3bc35e1fix: dashboard 'Clear Offline' button fails with JSON parse error📊 Changes
3 files changed (+17 additions, -4 deletions)
View changed files
📝
pkg/util/http/handler.go(+1 -1)📝
server/http/controller.go(+1 -1)📝
web/frps/src/api/http.ts(+15 -2)📄 Description
Summary
Fixes the "Clear Offline" button on the frps dashboard crashing with:
This is a confirmed bug reported independently by multiple users (#5233, #5236).
Root Cause
Two issues work together to cause this:
Backend (
pkg/util/http/handler.go):MakeHTTPHandlerFuncreturns HTTP 200 with an empty body when a handler returnsnil. The frontend only skips JSON parsing for 204 responses, so an empty-body 200 causesresponse.json()to throw.Frontend (
web/frps/src/api/http.ts): Therequest()function unconditionally callsresponse.json()on any non-204 response without checkingContent-Typeor body content. The frpc dashboard'shttp.tsalready had this check — the frps version was missing it.Changes
pkg/util/http/handler.go: Return204 No Content(instead of 200 with empty body) when a handler returnsnil. This is the correct REST semantics.server/http/controller.go:DeleteProxiesnow returnsnil(no body needed) — the 204 status code communicates success.web/frps/src/api/http.ts: AddedContent-Typecheck and empty-body handling before callingresponse.json(), consistent with the frpc dashboard implementation.Test Plan
go test ./server/...— all tests passFixes #5242
Related: #5233, #5236
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.