How to use the masonite.request.Request function in masonite

To help you get started, we’ve selected a few masonite examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github MasoniteFramework / masonite / tests / core / test_container.py View on Github external
def test_app_simple_bind_init(self):
        app = App()
        req = Request()
        app.simple(req)
        self.assertEqual(app.providers, {Request: req})
github MasoniteFramework / masonite / tests / core / test_extends.py View on Github external
def test_gets_input_with_all_request_methods(self):
        app = App()
        wsgi_request['QUERY_STRING'] = 'hey=test'
        request_class = Request(wsgi_request)
        app.bind('Request', request_class)
        request = app.make('Request').load_app(app)

        request.environ['REQUEST_METHOD'] = 'GET'
        self.assertEqual(request.input('hey'), 'test')

        request.environ['REQUEST_METHOD'] = 'POST'
        self.assertEqual(request.input('hey'), 'test')

        request.environ['REQUEST_METHOD'] = 'PUT'
        self.assertEqual(request.input('hey'), 'test')

        request.environ['REQUEST_METHOD'] = 'PATCH'
        self.assertEqual(request.input('hey'), 'test')

        request.environ['REQUEST_METHOD'] = 'DELETE'
github MasoniteFramework / masonite / tests / validation / test_validation.py View on Github external
def setUp(self):
        from masonite.request import Request
        self.app = App()
        self.app.bind('Request', Request().load_app(self.app))
        self.provider = ValidationProvider().load_app(self.app)
        self.provider.register()
        self.app.resolve(self.provider.boot)
github MasoniteFramework / masonite / tests / core / test_container.py View on Github external
def setUp(self):
        self.app = App()
        self.app.bind('Request', Request(None))
        self.app.bind('MockObject', MockObject)
        self.app.bind('GetObject', GetObject)
        self.app.bind('Container', self.app)
github MasoniteFramework / masonite / tests / core / test_requests.py View on Github external
def test_request_sets_request_method(self):
        wsgi = generate_wsgi()
        wsgi['QUERY_STRING'] = '__method=PUT'
        request = Request(wsgi)

        assert request.has('__method')
        self.assertEqual(request.input('__method'), 'PUT')
        self.assertEqual(request.get_request_method(), 'PUT')
github MasoniteFramework / masonite / tests / helpers / test_view_helpers.py View on Github external
def test_request_view_helper_is_view_class(self):
        self.assertIsInstance(self.view._shared['request'](), Request)
github MasoniteFramework / masonite / tests / helpers / test_compact.py View on Github external
def test_compact_throws_exceptions(self):
        r = Request(None)
        request = r
        with self.assertRaises(AmbiguousError):
            compact(request)
github MasoniteFramework / masonite / tests / helpers / test_compact.py View on Github external
def test_works_with_classes(self):
        request = Request(None)
        self.assertIn('request', compact(request))