Skip to content

[RFC] $request->body->get #47646

@ro0NL

Description

@ro0NL

Description

Hi,

I'd like to propose $request->body->get() (an InputBag) to provide uniform access to a structured request body payload, regardless of content-type.

$request->request always looked weird to me, and is bound to $_POST, thus application/x-form-urlencoded:

public static function createFromGlobals(): static

Then for application/json one needs toArray():

public function toArray(): array

Example

$request->body = new InputBag($_POST ?: $request->toArray());

Metadata

Metadata

Assignees

Labels

HttpFoundationRFCRFC = Request For Comments (proposals about features that you want to be discussed)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions