Skip to content

Conversation

@albertcht
Copy link
Member

This PR adds a new decodeUsing function to extend response decoding capabilities. It allows developers to support decoding methods other than JSON.

@albertcht albertcht requested a review from Copilot December 22, 2025 03:54
@albertcht albertcht added the feature New feature or request label Dec 22, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a decodeUsing method to the HTTP client's Response class, enabling developers to provide custom decoding logic as an alternative to the default JSON decoding. This allows handling of non-JSON response formats such as pipe-delimited, XML, or other custom formats.

Key Changes

  • Added decodeUsing method to set custom decoder callbacks
  • Refactored decoding logic into a centralized decode method
  • Updated json() and object() methods to use the new decode mechanism

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

File Description
src/http-client/src/Response.php Implements the decodeUsing method, adds $decodeUsing property, and refactors decoding logic into a new protected decode method
tests/HttpClient/HttpClientTest.php Adds test case demonstrating custom decoder usage with a pipe-delimited format

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@albertcht albertcht merged commit add82b0 into main Dec 22, 2025
12 checks passed
@albertcht albertcht deleted the albert/feature/http-client-decode-using branch January 5, 2026 03:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants