使用Postman测试.net Core 2页面返回400错误请求 [英] test .net core 2 page using Postman return 400 bad request

查看:773
本文介绍了使用Postman测试.net Core 2页面返回400错误请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了.net core 2页面的默认项目模板,而不是我尝试使用postman
测试对页面OnPostAsync(不是api控制器)的调用,但是我总是收到400错误的请求,试图

这会起作用后,我的目标是进行端到端/负载测试



谢谢!








解决方案

答案原为找到


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!

解决方案

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

这篇关于使用Postman测试.net Core 2页面返回400错误请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆