Skip to content

Commit

Permalink
reset httpclient-cache and -factory after each test case
Browse files Browse the repository at this point in the history
  • Loading branch information
newtork committed Sep 3, 2024
1 parent 5edcf71 commit 7474fb1
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import org.apache.hc.core5.http.io.entity.InputStreamEntity;
import org.apache.hc.core5.http.message.BasicClassicHttpResponse;
import org.assertj.core.api.SoftAssertions;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
Expand All @@ -52,6 +53,11 @@ void setup(WireMockRuntimeInfo server) {
DefaultHttpDestination.builder(server.getHttpBaseUrl()).build();
client = OpenAiClient.withCustomDestination(destination);
ApacheHttpClient5Accessor.setHttpClientCache(ApacheHttpClient5Cache.DISABLED);
}

@AfterEach
void reset() {
ApacheHttpClient5Accessor.setHttpClientCache(null);
ApacheHttpClient5Accessor.setHttpClientFactory(null);
}

Expand Down

0 comments on commit 7474fb1

Please sign in to comment.