This pull request includes changes to the user deletion functionality in our application. Previously, the user ID was passed as a URL parameter to delete a user. This PR refactors the endpoint to instead expect the user ID in the request body, aligning with best practices for DELETE operations that require a payload.
Summary
Changed the delete operation in routes/user.routes.js to use req.body.id instead of req.params.id for identifying the user to be deleted. This modification ensures that the user ID is securely transmitted in the request body.
Updated the corresponding test in test/user.test.js to reflect this change. The test now sends the user ID in the body of the DELETE request, ensuring our tests are aligned with the updated endpoint functionality.
Ensured that the API returns a 404 status code with a 'User not found' message if the user does not exist, maintaining the robustness of our error handling.
The changes ensure better security and align with RESTful API best practices by avoiding the use of URL parameters for sensitive information.
Fixes #111.
🎉 Latest improvements to Sweep:
New dashboard launched for real-time tracking of Sweep issues, covering all stages from search to coding.
Integration of OpenAI's latest Assistant API for more efficient and reliable code planning and editing, improving speed by 3x.
PR Feedback (click)
Description
This pull request includes changes to the user deletion functionality in our application. Previously, the user ID was passed as a URL parameter to delete a user. This PR refactors the endpoint to instead expect the user ID in the request body, aligning with best practices for DELETE operations that require a payload.
Summary
delete
operation inroutes/user.routes.js
to usereq.body.id
instead ofreq.params.id
for identifying the user to be deleted. This modification ensures that the user ID is securely transmitted in the request body.test/user.test.js
to reflect this change. The test now sends the user ID in the body of the DELETE request, ensuring our tests are aligned with the updated endpoint functionality.Fixes #111.
🎉 Latest improvements to Sweep:
💡 To get Sweep to edit this pull request, you can:
This is an automated message generated by Sweep AI.