What method should I use for a login (authentication) request?
问题 I would like to know which http method I should use when doing a login request, and why? Since this request creates an object (a user session) on the server, I think it should be POST, what do you think? But since the login request should be idempotent, it could be PUT, couldn't it? Same question for a logout request, should I use the DELETE method? 回答1: If your login request is via a user supplying a username and password then a POST is preferable, as details will be sent in the HTTP