feat: add source-specific typed request input#10216
Open
memleakd wants to merge 1 commit into
Open
Conversation
f4209f6 to
b7de579
Compare
Signed-off-by: memleakd <121398829+memleakd@users.noreply.github.com>
b7de579 to
7c31ebe
Compare
Contributor
Author
|
The current PHPStan failure appears unrelated to this PR. It is in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This PR proposes source-explicit typed input access for
IncomingRequest:This builds on
CodeIgniter\Input\InputDataand gives applications a clearer way to consume raw request values without relying on mixed request input.The new methods keep the input source visible at the call site:
getQueryInput()reads query-string parameters.getPostInput()reads POST body parameters.getPayloadInput()reads the request body payload.getPayloadInput()follows the same request-source behavior used by Form Requests: JSON requests use the decoded JSON body,PUT,PATCH, andDELETErequests use parsed raw input when they are not multipart requests, and ordinary form requests use POST body parameters. For non-JSONGETandHEADrequests, payload input is empty so query-string reads remain explicit throughgetQueryInput().These helpers do not validate input or replace Validation/FormRequest. They only provide fallback-friendly typed access to source-specific raw request data.
Tests cover source isolation, typed fallback access, JSON payloads, raw write-method payloads, POST payloads, empty
GET/HEADpayloads, scalar JSON rejection, and invalid JSON behavior.Checklist: