异常情况

首先,这个问题只有我在网页上发送对应的PUT请求才会出现,使用postman发送这个PUT请求,完全不会出错,所以可以将问题定位到应该是HTML代码出了问题

出现这个问题,因为之前没遇到过,所以直接网络上百度了,但是没有一个和我出错的情况是对应的.
例如有些说没有导入jackson,其实基本不可能,因为jackson会被springboot工程默认导入,因此基本不会是由于jackson没有导入而引起的.
那么出现这个问题是为什么呢?
先回到问题本身,他显示的是Content-type出了问题,知道一点Http协议的应该都知道Content-type是请求头里面的一个属性,因此在出这个问题的时候,先返回页面然后再次模拟这个导致错误的请求发生的情况.

可以发现,这个请求他发送的Content-type是一个完全不存在的类型,application.yml/json,首先yml后缀就已经代表了这个一个资源文件的格式,所以为什么这种奇怪的东西会出现在请求头里?
既然了解了是请求头的问题,那么我就想着,修改一下请求头的Content-type的请求格式不就好了吗,对吧
然后由于我是用的是axios,所以就出现了下面这个情况

所以你只需要在使用了axios的地方前面加上

  axios.defaults.withCredentials = true;axios.defaults.headers = {'Content-Type' : 'application/json;charset=UTF-8',}

效果如下图所示,就可以解决问题了

HttpMediaTypeNotSupportedException: Content type ‘application.yml/json;charset=UTF-8‘ not supported相关推荐

  1. HttpMediaTypeNotSupportedException: Content type ‘application/x-www-form-urlencoded;charset=UTF-8‘ n

    问题如下: Resolved [org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'applicatio ...

  2. Resolved [org.springframework.web.HttpMediaTypeNotSupportedException: Content type ‘application/x-ww

    报错原因,前端传回数据并不是JSON数据格式,这里我用的Swagger,修改以下选项. 同时注意在PostMapping中写上接受数据类型 前后端传回接受数据格式相同,报错已解决

  3. Springboot 报错Content type ‘application/x-www-form-urlencoded;charset=UTF-8‘ not supported

    SpringBoot错误解决 1.错误展示 2021-03-23 12:20:02.805 ERROR org.springframework.web.HttpMediaTypeNotSupporte ...

  4. Spring Boot——[Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported]解决方案

    问题描述 2020-02-13 19:32:04.322 WARN 109508 --- [p-nio-80-exec-4] .m.m.a.ExceptionHandlerExceptionResol ...

  5. 上传文件.HttpMediaTypeNotSupportedException:Content type ‘multipart/form-data;

    org.springframework.web.HttpMediaTypeNotSupportedException:Content type 'multipart/form-data;boundar ...

  6. “Content type ‘application/x-www-form-urlencoded;charset=UTF-8‘ not supported“解决方法

    项目接口返回 code: 500 data: null message: "Content type 'application/x-www-form-urlencoded;charset=U ...

  7. Content type ‘application/x-www-form-urlencoded;charset=UTF-8‘ not supported

    问题描述: 我写了一个接口,这个接口参数是这样的 @ResponseBody @RequestMapping(value = "importData", method = Requ ...

  8. jmeter报“msg“:“Content type ‘application/x-www-form-urlencoded;charset=UTF-8‘ not supported“的解决方法

    jmeter报"msg":"Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supp ...

  9. Error while extracting response for type [class xxx] and content type application/xml;charset=UTF-8

    强烈推荐一个大神的人工智能的教程:http://www.captainbed.net/zhanghan [前言] 最近在用restTemplate进行一次http请求时发现了报错(Error whil ...

最新文章

  1. 电商第一季函数笔记(1)
  2. jpa 公共字段顺序_临沂沂水景观花箱销售公司公共使用
  3. Mysql中导入和导出数据库
  4. AcWing 852. spfa判断负环(spfa or bellman)
  5. 中石油acm4985: Going Dutch 还钱问题(状压dp)
  6. MQTT教程(二):MQTT中的可变报头
  7. python运维都做些什么,Python运维工程师主要做什么?岗位职责!
  8. 软考程序员-C专题(1)
  9. webstorm主题网址+使用方法
  10. c 语言基础笔试题1
  11. 分布式机器学习:算法、理论与实践
  12. 当我再次看到你————中秋致Leslie
  13. 深信服技术认证之使用spark进行数据分析示例之拆分字段
  14. VLAN中SVL和IVL的区别
  15. 一文搞懂广播电视节目制作经营许可证办理流程
  16. 如何在cad中导入谷歌地图_如何在Google地图中设置出发和到达时间
  17. 3366 打豆豆 瞄准线 源码程序
  18. 喜讯:世界首款阿兹海默老年痴呆症治疗药将上市
  19. linux usb子系统.框架
  20. date类型的时间转换成年月日格式

热门文章

  1. C#实现给PDF文档设置过期时间
  2. 大数据分析:王宝强离婚事件到底有多火热!
  3. 中国羊毛针织纱行业市场供需与战略研究报告
  4. ACM模板(满注释模板!)
  5. 计算机网络知识全面讲解:抓包分析SMTP和POP3
  6. sql 修改列名及表名
  7. 如何检测WiFi 6E的高频信号?(二)
  8. EOJ 3256 拼音魔法 题解
  9. 随想杂谈--一个GPIO控制两个按键的方法
  10. rⅰd的意思_自动挡上的P、R、N、D、S、L是啥意思?一个口诀教会你!