空手道会自动设置Content

编程入门 行业动态 更新时间:2024-10-06 22:23:57
本文介绍了空手道会自动设置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:

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

有关详细示例,请参见: content-type.feature

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

更多推荐

空手道会自动设置Content

本文发布于:2023-11-25 06:19:10,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1628647.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:空手道   Content

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!