mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 14:30:41 +00:00
fix: track mutations by method, not body presence
POST/DELETE without a body were not recorded because postDataJSON() returns null. Track based on HTTP method instead.
This commit is contained in:
@@ -109,11 +109,17 @@ export class AssetHelper {
|
||||
const url = new URL(route.request().url())
|
||||
const method = route.request().method()
|
||||
const path = url.pathname
|
||||
const body = ['POST', 'PUT', 'DELETE'].includes(method)
|
||||
? route.request().postDataJSON()
|
||||
: null
|
||||
const isMutation = ['POST', 'PUT', 'DELETE'].includes(method)
|
||||
let body: Record<string, unknown> | null = null
|
||||
if (isMutation) {
|
||||
try {
|
||||
body = route.request().postDataJSON()
|
||||
} catch {
|
||||
body = null
|
||||
}
|
||||
}
|
||||
|
||||
if (body !== null) {
|
||||
if (isMutation) {
|
||||
this.mutations.push({
|
||||
endpoint: path,
|
||||
method,
|
||||
|
||||
Reference in New Issue
Block a user