-
Notifications
You must be signed in to change notification settings - Fork 259
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
noContent responses still get status code 200 added #324
Comments
As mentioned here, it must return 204 if there is no response. Waiting for @jasonmccreary decision and I can fix this if he agreed about the change. |
I'd want to check this as I am confused on what outputs what. In general, there is nothing wrong with a However, to @devmsh's comment, there may be something better depending on the context (e.g. the |
Unfortunately, I did not get it. Both 200 and 204 works, but 204 seems more standardized in the restful API world. |
Interesting. On running the draft file above, I get an error: Argument 1 passed to Blueprint\Generators\Statements\ResourceGenerator::visibleColumns() must be an instance of Blueprint\Models\Model, null given, called in /Users/jason/workspace/turbo-zonda/vendor/laravel-shift/blueprint/src/Generators/Statements/ResourceGenerator.php on line 105 |
Just test it with v1.16.0 in a fresh Laravel installation and it works fine. Maybe because Laravel has a default user model already? |
So I looked through the unit tests and the ControllerGeneratorTest has a few drafts that have the same behavior. The culprit seems to be this default configuration for api resource controllers: blueprint/src/Lexers/ControllerLexer.php Lines 126 to 129 in 7c9a32e
Changing it to |
@SpaceMotion or @devmsh, can you submit the PR to fix this. I'm still not fully understanding the issue, other than a less than desired response code. |
Issue:
(This might be intended behavior)
Generated controllers that return
response()->noContent()
seem to still get200
as their status code added. AfaiknoContent()
should return 204 (the default).The code even mentions it being excluded, but the status code seems to be set incorrectly?
blueprint/src/Models/Statements/RespondStatement.php
Line 45 in e685017
draft.yaml:
generates:
The text was updated successfully, but these errors were encountered: