如何使用Karate仅发送"application/json"作为内容类型标头? [英] How can I send just 'application/json' as the content-type header with Karate?
问题描述
我正在尝试为我无法控制的服务编写我的第一个测试.该服务验证传入请求的标头,对于内容类型标头,它要求该值是application/json
,并且仅该值.但是,当我尝试编写测试并将内容类型标头设置为仅具有此值时,生成的标头将具有以下值:application/json; charset=UTF-8
I'm trying to write my first test for a service that I have no control over. The service validates headers on incoming requests and for the content-type header it requires that the value be application/json
, and only that value. However when I try to write a test and explicitly set the content-type header to only have this value, the header that is generated has the following value instead: application/json; charset=UTF-8
此额外的charset=UTF-8
值阻止我的测试通过.反正有什么办法阻止空手道添加它?
This additional charset=UTF-8
value is preventing my test from passing. Is there anyway to prevent Karate from adding it?
推荐答案
Content-Type
上的UTF-8
默认设置可以被
* configure charset = null
请参考空手道文档
这篇关于如何使用Karate仅发送"application/json"作为内容类型标头?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!