无法从空手道配置Content-Type标头 [英] Unable to configure Content-Type header from karate

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

问题描述

am试图从空手道配置标头'Content-Type',但我无法这样做.我尝试了以下这些* configure标头= {'Content-Type':'application/json; charset = UTF-8'}和*标头Content-Type ='application/json; charset = UTF-8'.但是在发给我的帖子中,我总是得到Content-Type:text/plain这是错误的.有人可以帮忙吗?非常感谢!

am trying to configure the header 'Content-Type' from karate and I am not able to do so. I tried these * configure headers = {'Content-Type' : 'application/json;charset=UTF-8'} and * header Content-Type = 'application/json;charset=UTF-8'. But in the post call I am making , I always get Content-Type: text/plain which is wrong. Can anyone help? Thanks a lot!

推荐答案

实际上,没关系.我只是通过添加*标头Content-Type ='application/json'而不是Content-Type':'application/json **; charset = UTF-8而克服了这个问题.我删除了; charset = UTF-8.如果我添加它,它会中断.我收到错误java.lang.IllegalArgumentException:MIME类型可能不包含保留字符在org.apache.http.util.Args.check(Args.java:36).

Actually, never mind. I got over this by just adding * header Content-Type = 'application/json' rather than Content-Type' : 'application/json**;charset=UTF-8. I removed ;charset=UTF-8. If i add this, it breaks. I get an error java.lang.IllegalArgumentException: MIME type may not contain reserved characters at org.apache.http.util.Args.check(Args.java:36).

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

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