Commit ceeeb18
authored
chore: cherry-pick transfer-encoding fix to v2 (#3304)
* fix(http): make Transfer-Encoding detection case-insensitive
The HTTP response decoder was checking for "Transfer-Encoding: chunked"
using a case-sensitive substring match on the raw header block.
Some upstream services (e.g. the Java-based config service) emit
"Transfer-encoding: chunked", which caused our code to skip the
chunked-body handling path entirely and treat the response as if it
had no proper body.
As a result, Keploy would:
- only capture the headers in the reconstructed response buffer
- log "failed to read the http response body: unexpected EOF" in Capture
- save testcases with empty or truncated response bodies for those endpoints
The fix normalizes header names before checking for transfer-encoding,
so both "Transfer-Encoding" and "Transfer-encoding" (and any other
case variants) correctly trigger chunked-response handling.
Signed-off-by: Anju Pathak <anjupathak9810@gmail.com>
* Improve chunked response handling in chunk.go
Refactor logic for handling chunked responses in HTTP.
Signed-off-by: Anju <168076172+anjupathak03@users.noreply.github.com>
---------
Signed-off-by: Anju Pathak <anjupathak9810@gmail.com>
Signed-off-by: Anju <168076172+anjupathak03@users.noreply.github.com>1 parent 0fac6f2 commit ceeeb18Copy full SHA for ceeeb18
File tree
Expand file treeCollapse file tree
1 file changed
+48
-28
lines changedOpen diff view settings
Filter options
- pkg/core/proxy/integrations/http
Expand file treeCollapse file tree
1 file changed
+48
-28
lines changedOpen diff view settings
Collapse file
pkg/core/proxy/integrations/http/chunk.go
Copy file name to clipboardExpand all lines: pkg/core/proxy/integrations/http/chunk.go+48-28Lines changed: 48 additions & 28 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
46 | 46 | |
47 | 47 | |
48 | 48 | |
49 | | - |
50 | | - |
| 49 | + |
51 | 50 | |
52 | | - |
53 | | - |
54 | | - |
55 | | - |
56 | | - |
57 | | - |
| 51 | + |
| 52 | + |
| 53 | + |
| 54 | + |
| 55 | + |
| 56 | + |
| 57 | + |
| 58 | + |
| 59 | + |
| 60 | + |
| 61 | + |
| 62 | + |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | + |
| 67 | + |
| 68 | + |
58 | 69 | |
59 | 70 | |
60 | 71 | |
| ||
75 | 86 | |
76 | 87 | |
77 | 88 | |
78 | | - |
79 | | - |
80 | | - |
81 | | - |
82 | | - |
83 | | - |
84 | | - |
| 89 | + |
| 90 | + |
| 91 | + |
| 92 | + |
| 93 | + |
85 | 94 | |
86 | 95 | |
87 | 96 | |
| ||
221 | 230 | |
222 | 231 | |
223 | 232 | |
224 | | - |
225 | | - |
226 | | - |
227 | | - |
228 | | - |
229 | | - |
| 233 | + |
| 234 | + |
| 235 | + |
| 236 | + |
| 237 | + |
| 238 | + |
| 239 | + |
| 240 | + |
| 241 | + |
| 242 | + |
| 243 | + |
| 244 | + |
| 245 | + |
| 246 | + |
| 247 | + |
| 248 | + |
| 249 | + |
| 250 | + |
| 251 | + |
230 | 252 | |
231 | 253 | |
232 | 254 | |
| ||
245 | 267 | |
246 | 268 | |
247 | 269 | |
248 | | - |
249 | | - |
250 | | - |
251 | | - |
252 | | - |
253 | | - |
254 | | - |
| 270 | + |
| 271 | + |
| 272 | + |
| 273 | + |
| 274 | + |
255 | 275 | |
256 | 276 | |
257 | 277 | |
|
0 commit comments