File tree Expand file tree Collapse file tree
teaql-tool-http/src/test/java/io/teaql/tools/http Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : HTTP resilience cross-OS
2+
3+ on :
4+ workflow_dispatch :
5+ push :
6+ branches : [main]
7+ paths :
8+ - .github/workflows/http-platforms.yml
9+ - pom.xml
10+ - teaql-core/**
11+ - teaql-runtime/**
12+ - teaql-context-runtime-tools/**
13+ - teaql-tool-http/**
14+ - examples/http-resilience/**
15+ pull_request :
16+ branches : [main]
17+ paths :
18+ - .github/workflows/http-platforms.yml
19+ - pom.xml
20+ - teaql-core/**
21+ - teaql-runtime/**
22+ - teaql-context-runtime-tools/**
23+ - teaql-tool-http/**
24+ - examples/http-resilience/**
25+
26+ permissions :
27+ contents : read
28+
29+ jobs :
30+ http-resilience :
31+ name : HTTP contract and example (${{ matrix.os }})
32+ runs-on : ${{ matrix.os }}
33+ timeout-minutes : 60
34+ strategy :
35+ fail-fast : false
36+ matrix :
37+ os : [macos-26, macos-26-intel, windows-2025]
38+ defaults :
39+ run :
40+ shell : bash
41+ steps :
42+ - uses : actions/checkout@v4
43+ - name : Set up JDK 21
44+ uses : actions/setup-java@v4
45+ with :
46+ java-version : ' 21'
47+ distribution : temurin
48+ cache : maven
49+ - name : Run focused HTTP contract tests
50+ run : >-
51+ mvn -B -pl teaql-tool-http -am
52+ -Dtest=HttpResilienceTest
53+ -Dsurefire.failIfNoSpecifiedTests=false test
54+ - name : Run Context-owned HTTP example twice
55+ run : bash examples/http-resilience/verify.sh
Original file line number Diff line number Diff line change @@ -668,15 +668,17 @@ private void handle(Socket socket) {
668668 if (line .toLowerCase (java .util .Locale .ROOT ).startsWith ("content-length:" ))
669669 contentLength = Integer .parseInt (line .substring (line .indexOf (':' ) + 1 ).trim ());
670670 }
671- if (target .contains ("/retry-post" )) {
671+ // Drain the request before replying. Closing a socket with unread POST bytes
672+ // can reset an otherwise valid response on Windows TCP stacks.
673+ if (target .contains ("/retry-post" ) || target .contains ("/private-response" )) {
672674 char [] body = new char [contentLength ];
673675 int offset = 0 ;
674676 while (offset < body .length ) {
675677 int count = reader .read (body , offset , body .length - offset );
676678 if (count < 0 ) return ;
677679 offset += count ;
678680 }
679- retryBodies .add (new String (body ));
681+ if ( target . contains ( "/retry-post" )) retryBodies .add (new String (body ));
680682 }
681683 if (target .contains ("/close" )) return ;
682684 if (target .endsWith ("/slow" )) Thread .sleep (300 );
You can’t perform that action at this time.
0 commit comments