Files
marqdo-ext-http/tests/cases/http.json
cflmy d0d654179e
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/pr/ci Pipeline was successful
fix: allocate HTTP byte buffers by actual size and build headers once
Fix marqdo-ext-http#13: `http.文本字节` allocated a fixed 8 MiB Memory region on
every call, and `http.构建请求字节` called it once for the request line and once
per header, so a 6-header request spent ~56 MiB of the default 64 MiB run
budget and a second request failed with `resource.exhausted`.

- `文本字节`: request the minimal page count for the actual text (4-byte
  UTF-8 worst case per codepoint, 128-page cap, 1 page minimum).
- `构建请求字节`: concatenate the request line and all headers into one text,
  encode once, then concatenate the body; per-header fixed allocations are gone.
- Public signatures and produced request bytes are unchanged (`构建请求` text
  API stays compatible).
- Regression case: under the default budget, build the same 6-header request 8
  times and assert the final byte length/request text; the old code failed on
  the second build.
- docs/evidence records the real CLI/Bundle run.

No CLI/Host change, no new Host request, no release; real loopback multi-request
exchange (#3) and the optional streaming response view remain open/UNVERIFIED.
2026-11-30 12:22:44 +08:00

61 lines
1.2 KiB
JSON

{
"schema": "marqdo.package-test-case",
"schema_version": 1,
"name": "http",
"file": "http.mq.md",
"dep_alias": "http",
"args": [],
"stdin": "",
"env": {},
"expected_stdout": "",
"expected_terminal": {
"items": [
{
"decimal": "200",
"type": "int"
},
{
"type": "text",
"value": "OK"
},
{
"type": "text",
"value": "text/plain"
},
{
"type": "text",
"value": "hello world"
},
{
"type": "text",
"value": "POST /echo HTTP/1.1\r\nHost: example.test\r\nContent-Length: 2\r\n\r\nok"
},
{
"decimal": "200",
"type": "int"
},
{
"type": "text",
"value": "你好"
},
{
"type": "text",
"value": "POST / HTTP/1.1\r\n\r\nAB"
},
{
"type": "int",
"decimal": "8"
},
{
"type": "int",
"decimal": "169"
},
{
"type": "text",
"value": "POST /v1/chat HTTP/1.1\r\nHost: example.test\r\nAuthorization: Bearer x\r\nContent-Type: application/json\r\nContent-Length: 2\r\nConnection: close\r\nAccept: application/json\r\n\r\n{}"
}
],
"type": "list"
}
}