test .net core 2 page using Postman return 400 bad

2020-07-22 20:02发布

I created default project template of .net core 2 pages , than I'm trying to test a call to a page OnPostAsync (not api controller) using postman , but I always get 400 bad request , tried to play with headers etc` but with no success , any 1 manage to do this?
After this will work ,my goal is to do do end-to-end/load tests

thanks!

enter image description here enter image description here

enter image description here

enter image description here

1条回答
爷的心禁止访问
2楼-- · 2020-07-22 20:31

answer was found https://github.com/aspnet/Mvc/issues/7012 which it's a workaround to disable IgnoreAntiforgeryToken using [IgnoreAntiforgeryToken(Order = 1001)] on PageModel

enter image description here

查看更多
登录 后发表回答