ulsdevteam / lcsu

0 stars 0 forks source link

Use appropriate HTTP methods for actions #7

Closed ctgraham closed 5 years ago

ctgraham commented 5 years ago

The method deleteBooksByTray() makes a state change within the application, so it should require a HTTP method which represents a state change. For example, POST (update), PUT (insert), or DELETE (remove).

https://github.com/ulsdevteam/lcsu/blob/fd1e3dc5a1307831f0275fafc29c4aa746a60f90/src/Controller/BooksController.php#L200-L208

This is the meaning behind a line such as: https://github.com/ulsdevteam/lcsu/blob/fd1e3dc5a1307831f0275fafc29c4aa746a60f90/src/Controller/BooksController.php#L81

Relatedly, what does it mean to POST to ShelvesController::findAvailable()? https://github.com/ulsdevteam/lcsu/blob/fd1e3dc5a1307831f0275fafc29c4aa746a60f90/src/Controller/ShelvesController.php#L201-L203

edensung25 commented 5 years ago

ShelvesController::findAvailable() When users select a new tray size and press the submit button, it redirects the page to itself to reset the table content and the paginate. Otherwise, if the request is 'GET' method, it will change pages. This is the simplest way I figured out, is there any other way to implement this page?

ctgraham commented 5 years ago

If the user's selection of a tray size in the initial form is not making a change to the system, the form's method would be better as a GET than a POST.