Add dot notation access to Http\Client\Request::data() #55757
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Greetings!
This PR introduces a backwards-compatible enhancement to the
Illuminate\Http\Client\Request::data()
method by adding$key
parameter. This allows access to specific parts of the request data using "dot" notation.This behavior is consistent with conventions used across the framework for methods that interact with input, request or response data. It enables conventional access to request payloads (for example, when logging requests or writing HTTP client-based tests):
The
Request
class already supports similar access patterns for headers via theheader($key)
method. Since the word "data" can serve both as singular and plural I feel like this change also preserves naming consistency.