until [ -n "$(sockstat -l | awk '$2 == "socat" && $6 ~ /:8080$/')" ]; do sleep 1; done /usr/libexec/flua libfetch/test.lua === TEST 1: Request with headers and body Response size: 239 Response headers: table: 0x300168e7e280 >H Content-Type: text/plain >H Content-Length: 239 >H X-Test-Endpoint: /post >H Date: Mon, 13 Oct 2025 16:45:30 GMT Response trailers (before body read): table: 0x300168e7e2c0 Response body: file (0x28c9dedbe6a8) userdata >B Method: POST >B Path: /post >B Params: >B Headers: >B host: localhost:8080 >B content-length: 30 >B content-type: text/plain >B user-agent: flua libfetch/2.1 >B accept: */* >B connection: close >B x-test-header: LuaFetch >B Body: [[Hello from Lua fetch.xrequest!]] Response trailers: table: 0x300168e7e2c0 === PASS === TEST 2: Response with trailers collected Response size: -1 Response headers: table: 0x300168e12700 >H Transfer-Encoding: chunked >H Date: Mon, 13 Oct 2025 16:45:30 GMT >H X-Test-Endpoint: /trailers >H Content-Type: text/plain >H Trailer: baz,foo Response trailers (before body read): table: 0x300168e7e0c0 Response body: file (0x28c9dedbe570) userdata >B Method: GET >B Path: /trailers >B Params: >B baz: qux >B foo: bar >B Headers: >B host: localhost:8080 >B connection: close >B accept: */* >B user-agent: flua libfetch/2.1 Result of fetch.trailers(f) before f:close(): t1: table: 0x300168e7e0c0 t2: table: 0x300168e7e0c0 Response trailers: table: 0x300168e7e0c0 >T baz: qux >T foo: bar Result of fetch.trailers(f) after f:close(): t1: nil t2: nil === PASS === TEST 3: Response with trailers, response fields ignored Response size: -1 Response headers: nil Response trailers (before body read): nil Response body: file (0x28c9dedbe570) userdata >B Method: GET >B Path: /trailers >B Params: >B foo: bar >B baz: qux >B Headers: >B host: localhost:8080 >B user-agent: flua libfetch/2.1 >B accept: */* >B connection: close Result of fetch.trailers(f) before f:close(): t1: nil t2: nil Response trailers: nil === PASS === TEST 4: Response with empty trailers Response size: -1 Response headers: table: 0x300168e7e4c0 >H X-Test-Endpoint: /trailers >H Content-Type: text/plain >H Date: Mon, 13 Oct 2025 16:45:30 GMT >H Transfer-Encoding: chunked >H Trailer: Response trailers (before body read): table: 0x300168e7e500 Response body: file (0x28c9dedbe570) userdata >B Method: GET >B Path: /trailers >B Params: >B Headers: >B user-agent: flua libfetch/2.1 >B accept: */* >B host: localhost:8080 >B connection: close Result of fetch.trailers(f) before f:close(): t1: table: 0x300168e7e500 t2: table: 0x300168e7e500 Response trailers: table: 0x300168e7e500 Result of fetch.trailers(f) after f:close(): t1: nil t2: nil === PASS === TEST 5: Request with no trailers, no res_trailers passed Response size: 125 Response headers: table: 0x300168e7e580 >H X-Test-Endpoint: /get >H Content-Length: 125 >H Date: Mon, 13 Oct 2025 16:45:30 GMT >H Content-Type: text/plain Response trailers (before body read): nil Response body: file (0x28c9dedbe570) userdata >B Method: GET >B Path: /get >B Params: >B Headers: >B host: localhost:8080 >B accept: */* >B user-agent: flua libfetch/2.1 >B connection: close Response trailers: nil Result of fetch.trailers(f) after f:close(): t1: nil t2: nil === PASS === TEST 6: Streaming request body with trailers Response size: 246 Response headers: table: 0x300168e7e700 >H Content-Type: text/plain >H Content-Length: 246 >H Date: Mon, 13 Oct 2025 16:45:30 GMT >H X-Test-Endpoint: /post Response trailers (before body read): table: 0x300168e7e740 Response body: file (0x28c9dedbe6a8) userdata >B Method: POST >B Path: /post >B Params: >B Headers: >B connection: close >B user-agent: flua libfetch/2.1 >B host: localhost:8080 >B content-type: text/plain >B accept: */* >B transfer-encoding: chunked >B Body: [[ >B Streaming body! >B ]] >B Trailers: >B X-Stream-Trailer: trailer Response trailers: table: 0x300168e7e740 Result of fetch.trailers(f) after f:close(): t1: nil t2: nil === PASS === TEST 7: HEAD with no request body or trailers Response size: 0 Response headers: table: 0x300168e7e7c0 >H X-Test-Endpoint: /headers >H Content-Length: 0 >H Date: Mon, 13 Oct 2025 16:45:30 GMT >H Content-Type: text/plain Response trailers (before body read): table: 0x300168e7e800 Response body: file (0x28c9dedbe570) userdata Response trailers: table: 0x300168e7e800 Result of fetch.trailers(f) after f:close(): t1: nil t2: nil === PASS === TEST 8: HEAD with response headers Response size: 0 Response headers: table: 0x300168e7e880 >H baz: qux >H Date: Mon, 13 Oct 2025 16:45:30 GMT >H Content-Length: 0 >H X-Test-Endpoint: /headers >H Content-Type: text/plain >H foo: bar Response trailers (before body read): nil Response body: file (0x28c9dedbe570) userdata Response trailers: nil === PASS === TEST 9: Function as streaming request body Response size: 235 Response headers: table: 0x300168e7ea80 >H Content-Type: text/plain >H Content-Length: 235 >H X-Test-Endpoint: /post >H Date: Mon, 13 Oct 2025 16:45:30 GMT Response trailers (before body read): table: 0x300168e7eac0 Response body: file (0x28c9dedbe6a8) userdata >B Method: POST >B Path: /post >B Params: >B Headers: >B user-agent: flua libfetch/2.1 >B connection: close >B transfer-encoding: chunked >B accept: */* >B content-type: text/plain >B host: localhost:8080 >B Body: [[ >B chunk one >B chunk two >B chunk three >B ]] >B Trailers: Response trailers: table: 0x300168e7eac0 Result of fetch.trailers(f) after f:close(): t1: nil t2: nil === PASS === TEST 10: Request body as table with read and seek methods Response size: 205 Response headers: table: 0x300168e7ec00 >H X-Test-Endpoint: /post >H Date: Mon, 13 Oct 2025 16:45:30 GMT >H Content-Length: 205 >H Content-Type: text/plain Response trailers (before body read): table: 0x300168e7ec40 Response body: file (0x28c9dedbe6a8) userdata >B Method: POST >B Path: /post >B Params: >B Headers: >B host: localhost:8080 >B content-length: 21 >B user-agent: flua libfetch/2.1 >B connection: close >B accept: */* >B content-type: text/plain >B Body: [[Hello, seekable body!]] Response trailers: table: 0x300168e7ec40 Result of fetch.trailers(f) after f:close(): t1: nil t2: nil === PASS === TEST 11: Request with Accept override Response size: 132 Response headers: nil Response trailers (before body read): nil Response body: file (0x28c9dedbe570) userdata >B Method: GET >B Path: /get >B Params: >B Headers: >B accept: text/plain >B connection: close >B host: localhost:8080 >B user-agent: flua libfetch/2.1 Response trailers: nil === PASS === TEST 12: Request with User-Agent override Response size: 121 Response headers: nil Response trailers (before body read): nil Response body: file (0x28c9dedbe570) userdata >B Method: GET >B Path: /get >B Params: >B Headers: >B user-agent: libfetch test >B accept: */* >B host: localhost:8080 >B connection: close Response trailers: nil === PASS === RESULTS: passed: 12 skipped: 0 failed: 0