Resource.get(query) receives a RequestTarget: plain property access is silently undefined
I maintainer di solito rispondono entro 2 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 1/5
- Tempo stimato
- Meno di un'ora
- Idoneità per principianti
- 90/100
- Tipo di issue
- Documentazione
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- javascript, typescript
- Ambito
- documentation
Direzione di ricerca
Inizia da reference/resources/resource-api.md, dove è descritto get(query), quindi controlla resources/RequestTarget.ts per le proprietà del framework dichiarate direttamente. Usa come contesto l'esempio esistente target.get('param1'). Il lavoro è completato quando la reference identifica esplicitamente RequestTarget come estensione di URLSearchParams, spiega query.get('name') per i parametri personalizzati e l'accesso a proprietà semplici come undefined, ed elenca le proprietà dirette.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Document that a custom Resource.get(query) receives a RequestTarget, so plain property access is silently undefined
The trap
In a custom Resource handler, query is a RequestTarget, which extends URLSearchParams:
static async get(query) {
const ids = query.ids; // undefined, always, for a custom param
const ids = query.get('ids'); // correct
}
resources/RequestTarget.ts:5 — class RequestTarget extends URLSearchParams — declares only a
fixed set of framework properties (conditions, limit, select, sort, … ~:24-100). Arbitrary
query parameters are never assigned as own properties: resources/search.ts:1370's
NEEDS_PARSER = /[()[\]|!<>.]|(=\w*=)/ gates the FIQL parser, so a plain ?ids=1,2,3 (no special
characters) takes parseQuery's else branch (search.ts:1381-1406) and simply returns query
untouched.
So query.ids is undefined and there is no error — the handler quietly behaves as if the caller
sent nothing.
Why it's worth a doc callout rather than a code change
It fails silently, and it fails the same way for everyone writing their first custom Resource. It
already bit our own QA fixture: a DirectHistory test resource read query.ids and the bug stayed
invisible only because that parameter's value happened to equal the handler's default.
HarperFast/documentation reference/resources/resource-api.md:67 already shows the right form
(target.get('param1')) in an example, but nowhere states that the plain-property form silently
yields undefined. An example a reader can copy correctly is not the same as a warning a reader can
avoid; the failure mode needs naming.
Ask
In the resource-api reference, where get(query) is described:
- State that
queryis aRequestTarget extends URLSearchParams. - State that custom query parameters must be read with
query.get('name'), and that plain property
access returnsundefinedwithout error. - Note which properties are available directly (the declared framework set:
conditions,limit,
select,sort, …), so the distinction is learnable rather than a rule to memorize.
Not this
HarperFast/harper#135 ("A target should have parsed query properties in static REST methods") is
CLOSED (2026-04-15, PR #124 "Immediately parse search/queries in URLs provided to RequestTarget").
That fix made the declared special-purpose properties parse eagerly in the constructor; it never
made arbitrary custom parameter names land as own properties, and was not intended to. So this is not
covered by #135's closure — re-verified on main 6d725818c.
— Claude Opus 5.5
- Lingua principale
- MDX
- Stelle
- 9
- Fork
- 9
- Merge medio
- 1g 20h
- PR unite (30g)
- 16
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di HarperFast/documentation
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
HarperFast/documentation#677 ·
I maintainer di solito rispondono entro 2 giorni
-
Document markCredentialRejection / credentialRejectionError, the server.getUser rejection tagAperta
Difficoltà 2/5 Mezza giornata Idoneità per principianti 88/100
HarperFast/documentation#675 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
HarperFast/documentation#665 ·
I maintainer di solito rispondono entro 2 giorni
-
Add Harper deploy behaviorApertacontent
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
HarperFast/documentation#478 ·
I maintainer di solito rispondono entro 2 giorni
-
content
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 76/100
HarperFast/documentation#399 · 2 commenti ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di HarperFast/documentation
Issue simili
-
Broken links in the docsAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
microsoft/onnxruntime#33018 ·
I maintainer di solito rispondono entro 2 giorni
-
missing content writing algorithms
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
QuantConnect/Documentation#2739 ·
I maintainer di solito rispondono entro 1 giorno
-
:watch: Not Triaged dotnet-target-version
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
copilot documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
lichess-org/api#678 ·