How can I send just 'application/json' as the content-type header with Karate?

最后都变了- 提交于 2019-12-02 05:55:26

问题


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

This additional charset=UTF-8 value is preventing my test from passing. Is there anyway to prevent Karate from adding it?


回答1:


The default setting of UTF-8 on Content-Type can be overide by this,

* configure charset = null

Please refer charset in configure table from karate documentation



来源:https://stackoverflow.com/questions/53472047/how-can-i-send-just-application-json-as-the-content-type-header-with-karate

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!