popolo - code simple..

popolo - code simple..

How to Get Request Method in Masonite Project

How to Get Request Method in Masonite Project

Theodoros Kafantaris's photo
Theodoros Kafantaris
·May 4, 2022·

1 min read

In this short article, we will see how to get the request method in Masonite Project.

Let's see how to do this in a controller.

app/controllers/UserController.py

from masonite.controllers import Controller
from masonite.request import Request
from masonite.facades import Dump



class UserController(Controller):
    def show(self, request: Request):
        Dump.dd(request.get_request_method())

Possible output could be:

  • GET
  • POST
  • PUT
  • PATCH
  • DELETE
  • OPTIONS
 
Share this