Commit 666f7db
authored
fix(git): WAC preHandler 401/402/403 responses carry the git CORS headers (JavaScriptSolidServer#548) (JavaScriptSolidServer#550)
The 401/403 for an unauthorized git operation is emitted by the WAC
preHandler in src/server.js — before handleGit runs — and that path
set WAC-Allow / WWW-Authenticate but not the git CORS headers. A
browser-based git client (e.g. jss.live/git/) hitting an auth-gated
repo therefore saw a generic CORS/network error instead of the 401
auth challenge — the exact failure mode JavaScriptSolidServer#371 fixed for handleGit's
own paths.
Fix: export setGitCorsHeaders from src/handlers/git.js (it was
module-private) and apply it on the preHandler's early returns — the
402 paymentRequired branch and the 401/403 unauthorized branch. The
GIT_CORS_HEADERS doc comment is updated to name the new caller so it
stays the single source of truth.
The 402 branch gets the same one-line helper call as the tested
401/403 path; a dedicated 402 test would need a pay-gated git
fixture, which is disproportionate to an identical mechanical call —
the 401 test pins the helper's output.
Test: the deliberately-scoped 401 test from JavaScriptSolidServer#549 (which asserted
WWW-Authenticate but NOT CORS, with a pointer comment at this issue)
now asserts the full contract via assertGitCors. Test title, inline
comment, and the file docstring all updated to match the new
behaviour.
Full suite: 934/934 passing.
Closes JavaScriptSolidServer#548.1 parent 6e92f35 commit 666f7db
3 files changed
Lines changed: 25 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
170 | | - | |
171 | | - | |
172 | | - | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
173 | 175 | | |
174 | 176 | | |
175 | 177 | | |
176 | 178 | | |
177 | 179 | | |
178 | 180 | | |
179 | | - | |
| 181 | + | |
180 | 182 | | |
181 | 183 | | |
182 | 184 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
533 | 533 | | |
534 | 534 | | |
535 | 535 | | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
536 | 540 | | |
537 | 541 | | |
538 | 542 | | |
539 | 543 | | |
540 | 544 | | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
541 | 550 | | |
542 | 551 | | |
543 | 552 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
182 | | - | |
| 182 | + | |
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
| |||
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
201 | | - | |
202 | | - | |
203 | | - | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
204 | 205 | | |
205 | 206 | | |
206 | 207 | | |
| |||
0 commit comments