Commit 20b37ba
authored
feat(jsonrpc): add CustomHeader http.Header for multi-value headers
RPCClientOpts.CustomHeaders is a map[string]string applied via
http.Header.Set, which can only carry one value per name. Callers
that need to forward multi-value headers (Cookie, X-Forwarded-For,
or any other RFC 7230 list-form header) currently have to either
drop values or comma-join them — and comma-joining is wrong for
Cookie, whose RFC 6265 separator is "; ", not ", ".
Add a sibling CustomHeader field of type http.Header. Values are
copied verbatim into request.Header so multiple values per name
become multiple header lines on the wire.
Application order in newRequest is: library defaults
(Content-Type, Accept), then CustomHeaders (legacy), then
CustomHeader. CustomHeader therefore takes precedence for any
name present in both, and CustomHeaders behavior is unchanged
for callers that don't set CustomHeader, preserving backward
compatibility.
CustomHeaders is marked Deprecated in its godoc, pointing callers
to CustomHeader for new code.1 parent 20713fb commit 20b37ba
2 files changed
Lines changed: 95 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
271 | 271 | | |
272 | 272 | | |
273 | 273 | | |
| 274 | + | |
274 | 275 | | |
275 | 276 | | |
276 | | - | |
| 277 | + | |
| 278 | + | |
277 | 279 | | |
278 | | - | |
| 280 | + | |
| 281 | + | |
279 | 282 | | |
280 | | - | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
281 | 291 | | |
282 | | - | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
283 | 308 | | |
284 | 309 | | |
285 | 310 | | |
| |||
364 | 389 | | |
365 | 390 | | |
366 | 391 | | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
367 | 396 | | |
368 | 397 | | |
369 | 398 | | |
| |||
485 | 514 | | |
486 | 515 | | |
487 | 516 | | |
488 | | - | |
| 517 | + | |
| 518 | + | |
489 | 519 | | |
490 | 520 | | |
491 | 521 | | |
492 | 522 | | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
493 | 530 | | |
494 | 531 | | |
495 | 532 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
60 | 113 | | |
61 | 114 | | |
62 | 115 | | |
| |||
0 commit comments