[Bug]: http-client-js ignores `NoAuth` in a `@useAuth` union
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 57/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- typescript
- Ambito
- backend-api-design
Direzione di ricerca
Start by reading the http-client-js emitter's authentication handling and compare it with the Python emitter behavior referenced in the issue. Reproduce with the supplied @useAuth(BearerAuth | NoAuth) TypeSpec example using the listed package versions. Done means the generated constructor allows omitted credentials and an anonymous request has no Authorization header.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the bug
With @useAuth(BearerAuth | NoAuth), the client should allow anonymous requests. The emitted constructor requires a credential, and the bearer policy always sets Authorization: Bearer <token>. An empty token is not anonymous: some servers reject Authorization: Bearer with 401. Related: #6847 covers @useAuth(NoAuth) alone.
Reproduction
Every snippet uses this header:
import "@typespec/http";
using Http;
@service(#{ title: "Repro" })
@server("{endpoint}", "", { endpoint?: url = "http://localhost:3000" })
namespace Repro;
Emitted with @typespec/http-client-js (default options).
@useAuth(BearerAuth | NoAuth)
@get op read(): void;
Actual:
constructor(credential: BearerTokenCredential, options?: ReproClientOptions)
Expected: with NoAuth in the union, credential is optional, and the client sends no Authorization header without one. This matches the Python emitter (#9298).
Versions: @typespec/compiler 1.17.0, @typespec/http 1.17.0, @typespec/http-client-js 0.16.3. Also reproduced with the emitter built from main (721154b2a).
Checklist
- Follow our Code of Conduct
- Check that there isn't already an issue that request the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion.
- The provided reproduction is a minimal reproducible example of the bug.
- Lingua principale
- Java
- Stelle
- 5.9k
- Fork
- 421
- Merge medio
- 2g 3h
- PR unite (30g)
- 176
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- 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 microsoft/typespec
-
bug emitter:client:csharp
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
microsoft/typespec#12572 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Make website build cross-platform compatibleForse già presa @pcbeingused333 l’ha presa oggi. Apertabug meta:website
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
microsoft/typespec#12550 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Emitter framework: make the language-specific Alloy peer dependencies optionalForse già presa @timotheeguerin l’ha presa 8 giorni fa. Apertaemitter-framework feature triaged:core
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 62/100
microsoft/typespec#12476 · 1 commento · 2 reazioni · 2 assegnatari ·
I maintainer di solito rispondono entro 1 giorno
-
Upgrade C# generator Roslyn to 5.9.0Forse già presa @ArthurMa1978 l’ha presa 7 giorni fa. Apertaemitter:client:csharp feature
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
microsoft/typespec#12445 · 2 commenti · 1 reazione · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
bug emitter:client:python
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
microsoft/typespec#12360 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di microsoft/typespec
Issue simili
-
GCC 15.2: -Wcast-qual warning - cast discards const qualifier from pointer target type (H5trace.c)Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
I maintainer di solito rispondono entro 1 giorno
-
[Bug] RemotingHelper.connect swaps the socket send and receive buffer configurationForse già presa @amalsaidov l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
needs-area-label
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 2 giorni
-
area/ai area/backend component/zeebe kind/task
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
spAnser/reacharound#38 ·