chalice icon indicating copy to clipboard operation
chalice copied to clipboard

Chalice Testing issue for POST request in Blueprint

Open surajitkundu-dazn opened this issue 3 years ago • 2 comments

When I was trying to test a POST method from Blue Print the RestAPIEventHandler class routes are always GET so as a result I am always getting "Unsupported Method POST" from _main_rest_api_handler method in app.py. But if I move my method from bluprint module to main app.py then it works fine also when I deploy the app all looks ok and it work perfectly.

Blueprint function :

@singleRealTime.route("/", methods=["POST"]) def index(): return singleRealTime.current_request.json_body

Application Function:

@singleRealTime.route("/index", methods=["POST"]) def index(): return singleRealTime.current_request.json_body

Return Routes :

defaultdict(<class 'dict'>, {'/realtime/inference/v1/{team}/{model}': {'GET': <chalice.app.RouteEntry object at 0x7fd97d938a90>}, '/': {'GET': <chalice.app.RouteEntry object at 0x7fd97d938b10>}, '/index': {'POST': <chalice.app.RouteEntry object at 0x7fd97d938dd0>}})

surajitkundu-dazn avatar Apr 02 '22 19:04 surajitkundu-dazn

I'm also seeing this behavior. Working on digging into the problem. Did you find anything @surajitkundu-dazn?

mwoodsmall avatar Jun 03 '22 11:06 mwoodsmall

I'm also seeing this behavior. Working on digging into the problem. Did you find anything @surajitkundu-dazn?

Not yet , Right mow I am testing my POST method as GET in test script. Which is a problem because I have a route where GET and POST both the methods are present

surajitkundu-dazn avatar Jun 03 '22 13:06 surajitkundu-dazn