This commit is contained in:
Your Name
2026-08-27 16:26:14 +08:00
parent 4b8b4eb649
commit 43ad07208f
2 changed files with 43 additions and 5 deletions
@@ -95,6 +95,25 @@ $explicitOpenAi = callDifyStreamPrivate('buildRequestSpecs', [
difyStreamExpect(count($explicitDify) === 1 && $explicitDify[0]['protocol'] === 'dify', 'explicit Dify endpoint never changes protocol');
difyStreamExpect(count($explicitOpenAi) === 1 && $explicitOpenAi[0]['protocol'] === 'openai', 'explicit OpenAI endpoint never changes protocol');
$progressOption = callDifyStreamPrivate('curlProgressOption', []);
$expectedProgressOption = null;
foreach (['CURLOPT_XFERINFOFUNCTION', 'CURLOPT_PROGRESSFUNCTION'] as $optionName) {
if (defined($optionName)) {
$expectedProgressOption = (int) constant($optionName);
break;
}
}
difyStreamExpect(
$progressOption === $expectedProgressOption,
'stream cancellation selects the newest cURL progress callback available at runtime'
);
$serviceSource = file_get_contents(dirname(__DIR__) . '/app/common/service/DifyChatService.php');
difyStreamExpect(
is_string($serviceSource)
&& str_contains($serviceSource, "'CURLOPT_XFERINFOFUNCTION', 'CURLOPT_PROGRESSFUNCTION'"),
'stream cancellation retains the libcurl 7.29 progress callback fallback'
);
$retryableStream = [
'errno' => 0,
'http_code' => 200,