fix(javascript): filter keyed-collection receivers only for get/delete
The collection APIs share only `get` and `delete` with HTTP clients, so
`api.headers.post("/v1/headers")` and `api.searchParams.request("/s")`
keep their endpoints.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
eb68761eb0
commit
00f707b250
@@ -423,12 +423,15 @@ export const endpointArgument = (
|
||||
// `XMLHttpRequest.open(method, url)`.
|
||||
if (name.endsWith(".open") && isXhrMethodArgument(args[0]))
|
||||
return stringValue(args[1]);
|
||||
if (
|
||||
["get", "post", "put", "patch", "delete", "request"].some(
|
||||
(method) => name === method || name.endsWith(`.${method}`),
|
||||
)
|
||||
)
|
||||
return isKeyedCollectionReceiver(callee) ? undefined : stringValue(args[0]);
|
||||
const method = ["get", "post", "put", "patch", "delete", "request"].find(
|
||||
(candidate) => name === candidate || name.endsWith(`.${candidate}`),
|
||||
);
|
||||
if (method !== undefined)
|
||||
// Only get and delete also belong to the keyed-collection APIs.
|
||||
return (method === "get" || method === "delete") &&
|
||||
isKeyedCollectionReceiver(callee)
|
||||
? undefined
|
||||
: stringValue(args[0]);
|
||||
if (name.endsWith("loadURL")) return stringValue(args[0]);
|
||||
return undefined;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user