Skip to content

Conversation

@ChiragAgg5k
Copy link
Member

Summary

Migrates the test client implementation from a custom Tests\Client class to the official Utopia\Fetch\Client library.

Changes

  • Removed custom tests/Client.php class
  • Added utopia-php/fetch dependency to composer.json
  • Updated ExecutorTest.php to use Utopia\Fetch\Client
  • Added wrapper call() method to maintain backward compatibility with existing test code
  • Fixed deprecated nullable parameter warnings in ExecutorTest.php

Benefits

  • Standardizes HTTP client usage across the codebase
  • Uses official, maintained Utopia library
  • Reduces custom code maintenance burden
  • Fixes PHP 8.1+ deprecation warnings

Test plan

  • All existing tests continue to work without modification
  • The wrapper method ensures backward compatibility
  • No breaking changes to test functionality

- Remove custom tests/Client.php class
- Add utopia-php/fetch dependency
- Update ExecutorTest to use Utopia\Fetch\Client
- Add wrapper method to maintain backward compatibility with existing tests
- Fix deprecated nullable parameter warnings in ExecutorTest.php

This migration standardizes HTTP client usage across the codebase using
the official Utopia Fetch library instead of a custom implementation.
When using streaming callbacks, the response body is consumed by the
callback, so we should not attempt to decode it. This fixes the JSON
decode error in testLogStream and other streaming tests.
Instead of reusing a single client instance and accumulating headers,
create a new Client instance for each request with base headers +
request-specific headers. This matches the original behavior where
headers were merged per-request without modifying the instance.
@ChiragAgg5k ChiragAgg5k closed this Dec 8, 2025
@ChiragAgg5k ChiragAgg5k reopened this Dec 9, 2025
Copy link

@hmacr hmacr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ChiragAgg5k ChiragAgg5k merged commit 88e1b0b into main Dec 11, 2025
3 checks passed
@ChiragAgg5k ChiragAgg5k deleted the migrate-utopia-fetch-client branch December 11, 2025 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants