Add Dynamic HTTP Status Code for JSON Responses in React\Http\Message\Response by emrancu · Pull Request #507 · reactphp/http · GitHub
Skip to content

Add Dynamic HTTP Status Code for JSON Responses in React\Http\Message\Response#507

Open
emrancu wants to merge 3 commits into
reactphp:1.xfrom
emrancu:update-json-response
Open

Add Dynamic HTTP Status Code for JSON Responses in React\Http\Message\Response#507
emrancu wants to merge 3 commits into
reactphp:1.xfrom
emrancu:update-json-response

Conversation

@emrancu

@emrancu emrancu commented Nov 15, 2023

Copy link
Copy Markdown

This pull request enhances the React\Http\Message\Response class by introducing the ability to set dynamic HTTP status codes for JSON responses.

This feature provides developers with the flexibility to adapt status codes based on contextual requirements.

Comment thread src/Message/Response.php Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should also work:

Suggested change
public static function json($data, $status = null)
public static function json($data, $status = self::STATUS_OK)

@emrancu emrancu Nov 15, 2023

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thank you!! You are right.

@SimonFrings

Copy link
Copy Markdown
Member

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.

3 participants