Closed as not planned
Description
Proposal Details
Proposal Details
Quite often, inside the net/http package and in third-party packages that use net/http, you can see the following comparison of the request method:
if request.Method == "POST" {}
It's tedious to write this, so I suggest adding the following methods for the Request structure for this purpose:
func (r *Request) IsGet() bool
func (r *Request) IsHead() bool
func (r *Request) IsPost() bool
func (r *Request) IsPut() bool
func (r *Request) IsPatch() bool
func (r *Request) IsDelete() bool
func (r *Request) IsConnect() bool
func (r *Request) IsOptions() bool
func (r *Request) IsTrace() bool