Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PHPResponse.forHttpCode() shorthand #1322

Merged
merged 1 commit into from
Apr 25, 2024
Merged

Conversation

adamziel
Copy link
Collaborator

Short and sweet – adds a PHPResponse.forHttpCode() method to streamline the creation of various OK and error response objects.

For example:

// Before
const error500 = new PHPResponse(500, {}, new TextEncoder().encode("Internal Server Error"))

// After
const error500 = PHPResponse.forHttpCode(500);

Testing instructions

None, this PR only adds new code without using it just yet.

Short and sweet – adds a `PHPResponse.forHttpCode()` method to
streamline the creation of various OK and error response objects.

For example:

```ts
// Before
const error500 = new PHPResponse(500, {}, new TextEncoder().encode("Internal Server Error"))

// After
const error500 = PHPResponse.forHttpCode(500);
```

 ## Tes
@adamziel adamziel added [Type] Enhancement New feature or request [Type] New API New API to be used by package users. [Package][@php-wasm] Universal labels Apr 25, 2024
@adamziel adamziel merged commit 8dae0ca into trunk Apr 25, 2024
5 checks passed
@adamziel adamziel deleted the add-for-http-code-method branch April 25, 2024 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package][@php-wasm] Universal [Type] Enhancement New feature or request [Type] New API New API to be used by package users.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant