空手道会自动设置Content-Type标头 [英] Karate automatically sets Content-Type header

查看:94
本文介绍了空手道会自动设置Content-Type标头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

美好的一天!在我的否定测试用例中,我必须放置一个没有Content-Type头的请求,以匹配所需的4xx状态代码.问题是空手道会自动设置适当的Content-Type. 例如.当我通过{}作为请求时,它设置了application/json;字符集= UTF-8 当我按要求传递``时,它将设置文本/纯文本; charset = UTF-8

Good day! In my negative test cases I have to PUT a request without Content-Type header in order to match desired 4xx status code. The problem is karate automatically sets an appropriate Content-Type. E.g. when I pass {} as request it sets application/json; charset=UTF-8 when I pass '' as request it sets text/plain; charset=UTF-8

问题是如何在没有Content-Type标头的情况下发送PUT请求?

The question is how can I send a PUT request without a Content-Type header?

推荐答案

只需设置* configure charset = null:

这里是文档: https://github.com/intuit/karate#configure

有关详细示例,请参见:

For a detailed example, see: content-type.feature

这篇关于空手道会自动设置Content-Type标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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