How to use the muffin.HTTPBadRequest function in muffin

To help you get started, we’ve selected a few muffin 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 klen / muffin / tests / test_muffin.py View on Github external
def raise_400(request):
        raise muffin.HTTPBadRequest()
github klen / muffin / tests / test_muffin.py View on Github external
    @app.register(muffin.HTTPBadRequest)
    def handle_400(request):
        return muffin.Response(text='Custom 400', status=400)
github klen / muffin-admin / muffin_admin / handler.py View on Github external
async def post(self, request):
        """Create/Edit items."""
        form = await self.get_form(request)
        if not form.validate():
            raise muffin.HTTPBadRequest(
                text=json.dumps(form.errors), content_type='application/json')
        await self.save_form(form, request)
        raise muffin.HTTPFound(self.url)