Commit 981eaef
Add RCTHTTPRequestInterceptor for selective HTTP header injection (#55869)
Summary:
## Summary:
Replace the blind application of dev headers on all HTTP requests with an
interceptor pattern. A custom `RCTHTTPRequestInterceptor` block can be
registered via `RCTSetCustomHTTPRequestInterceptor` to inspect and modify
HTTP requests before they are sent. The interceptor returns a modified request
to override, or nil to use the original request unchanged. This preserves the
shared NSURLSession configuration (including meta-auth mTLS) while allowing
selective per-request header injection.
- Declare `RCTHTTPRequestInterceptor` typedef and
`RCTSetCustomHTTPRequestInterceptor` in RCTHTTPRequestHandler.h
- Implement the interceptor hook in RCTHTTPRequestHandler.mm
- Remove the previous blind `RCTDevSupportHttpHeaders` application
## Changelog:
[IOS][CHANGED] - Add RCTHTTPRequestInterceptor for selective HTTP request modification
## Test Plan:
Verified that the RCTHTTPRequestInterceptor block is called when registered,
and that returning nil leaves the original request unchanged. When no
interceptor is registered, behavior is unchanged from before.
## Facebook:
Applied from nest/mobile/apps/atod-sample/patches/react-native+0.83.1+006+atod-ios-http-handler.patch
Reviewed By: cortinico
Differential Revision: D950379201 parent 43a9e14 commit 981eaef
File tree
2 files changed
+24
-1
lines changed- packages/react-native/Libraries/Network
2 files changed
+24
-1
lines changedLines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
17 | 26 | | |
18 | 27 | | |
19 | 28 | | |
| |||
Lines changed: 15 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
28 | 35 | | |
29 | 36 | | |
30 | 37 | | |
| |||
99 | 106 | | |
100 | 107 | | |
101 | 108 | | |
102 | | - | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
103 | 117 | | |
104 | 118 | | |
105 | 119 | | |
| |||
0 commit comments