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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Min Web API: Corrected Put data in body #32498

Merged
merged 1 commit into from May 2, 2024

Conversation

wadepickett
Copy link
Contributor

@wadepickett wadepickett commented May 1, 2024

Fixes #32239

Minor change.

Two items were mentioned in the issue, only one turned out to need a fix which was to remove the id from the PUT data in the body. This fix was not needed for previous versions, just the current v 8.0.


Internal previews

馃搫 File 馃敆 Preview link
aspnetcore/tutorials/min-web-api.md Tutorial: Create a minimal API with ASP.NET Core

@wadepickett wadepickett requested a review from tdykstra May 1, 2024 23:36
@wadepickett wadepickett marked this pull request as ready for review May 1, 2024 23:37
@wadepickett wadepickett self-assigned this May 2, 2024
@tdykstra
Copy link
Contributor

tdykstra commented May 2, 2024

The issue mentions the status code being wrong, doesn't say anything about the id field. Does the link point to the right issue?

@wadepickett
Copy link
Contributor Author

The ID issue is detailed in the discussion portion of that issue.

"The other item on that page that should be updated is in the Test the PUT endpoint section.

The example provides the ID in the body of the request but it is not used by the logic:

Content-Type: application/json

{
"id": 1,
"name": "feed fish",
"isComplete": false
}

The "id": 1, line should be removed. The ID is pulled from the URI, not the body of the request."

@wadepickett
Copy link
Contributor Author

wadepickett commented May 2, 2024

Sorry, that is odd, I just edited your text rather than creating new text. Fixed it.

See my note about the ID problem brought up in the discussion, not the description. It is the right associated issue. I will change the Issue title so it is not confusing.

@wadepickett
Copy link
Contributor Author

While we technically can pass the ID in the body at the same time as specifying the ID in the URL, it would not be best practice to do both. It adds a bit of risk to the two pieces of data being out of sync.

@tdykstra
Copy link
Contributor

tdykstra commented May 2, 2024

Thanks for the clarification. Was the part about 200 vs. 204 incorrect, so nothing needed to be done?

@wadepickett
Copy link
Contributor Author

Thanks for the clarification. Was the part about 200 vs. 204 incorrect, so nothing needed to be done?

Correct. I verified following the instruction steps and could not recreate the 200 vs. 204 problem, and in the discussion I provided a screen shots of the results. Another community member also did the same.

@wadepickett
Copy link
Contributor Author

Sorry for the confusion, I should have also updated the original issue description to make it clear there were two issues brought up, but one was a non-issue, not reproducible. Thanks.

@wadepickett wadepickett merged commit c91c20a into main May 2, 2024
3 checks passed
@wadepickett wadepickett deleted the wadepickett/32239PutExample branch May 2, 2024 17:57
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.

Min Web API: Two problems: ID in PUT body and Put Example returns Status 200 not 204
2 participants