http409 415报错原因
409
今天一个同事的接口突然报409,大概百度了一下,不是很清楚,谷歌也没找到特别好的解释
因为是直接调用的gitlab,就直接看了下gitlab的api
The following table shows the possible return codes for API requests.
Return values | Description |
---|---|
200 OK
|
The GET , PUT or DELETE request was successful, and the resource itself is returned as JSON.
|
202 Accepted
|
The GET , PUT or DELETE request was successful, and the resource is scheduled for processing.
|
204 No Content
|
The server has successfully fulfilled the request, and there is no additional content to send in the response payload body. |
201 Created
|
The POST request was successful, and the resource is returned as JSON.
|
304 Not Modified
|
The resource hasn't been modified since the last request. |
400 Bad Request
|
A required attribute of the API request is missing. For example, the title of an issue is not given. |
401 Unauthorized
|
The user isn't authenticated. A valid user token is necessary. |
403 Forbidden
|
The request isn't allowed. For example, the user isn't allowed to delete a project. |
404 Not Found
|
A resource couldn't be accessed. For example, an ID for a resource couldn't be found. |
405 Method Not Allowed
|
The request isn't supported. |
409 Conflict
|
A conflicting resource already exists. For example, creating a project with a name that already exists. |
412
|
The request was denied. This can happen if the If-Unmodified-Since header is provided when trying to delete a resource, which was modified in between.
|
422 Unprocessable
|
The entity couldn't be processed. |
429 Too Many Requests
|
The user exceeded the application rate limits. |
500 Server Error
|
While handling the request, something went wrong on the server. |
gitlab解释的很清晰,就是说资源已经存在了,再次创建失败
那为什么接口没有将报错message展示出来,查了一下代码是因为直接屏蔽了409状态码,直接用postman访问接口会返回具体错误信息,错误提示信息示例:
示例1:
{
"message": "Email has already been taken"
}
示例2:
{
"message": "Username has already been taken"
}
找gitlab负责人查了下数据,确实是用户已经存在了,但是用户状态是blocked(禁用),问题解决
-----------------------------------我是分割线-----------------------------------
415
好巧不巧,今天又一个项目遇到了一个奇怪的错误码415,平时开发不常见,让我去帮忙排查
先简单了解了一下,服务A直接通过postman调用是可以的,但是就是别的服务调用服务A响应415,先百度,直接说是请求头不支持导致的
查看postman请求头,Content-Type是application/json;改下请求头(直接取消传递Content-Type,默认),响应415,具体响应内容如下
{"timestamp": "2023-02-14T09:55:54.342+0000","status": 415,"error": "Unsupported Media Type","message": "Content type 'application/octet-stream' not supported","path": "/zhanye-admin/iam/sync/SchemaService"}
改成text/plain,则响应还是415,具体响应
{"timestamp": "2023-02-14T09:58:07.376+0000","status": 415,"error": "Unsupported Media Type","message": "Content type 'text/plain;charset=UTF-8' not supported","path": "/zhanye-admin/iam/sync/SchemaService"}
基本能确定是调用方请求头的问题,但是调用方说自己调用没问题,调用服务A跟调用别的系统都一样,别的服务都正常,就是服务A一直报错,服务A的开发同学也很委屈,我postman调用正常...
那就直接curl调用一下试试吧,直接在B服务所在的服务器调用A服务,正常,ok,这就确定了是B服务调用的问题,直接将调用请求和响应截图给B服务开发同学,让他排查问题,最终发现B服务的请求头中Content-Type不是application/json,而是text/plain
http409 415报错原因相关推荐
- 闪退没由报错_秉承工匠精神,3步定位飞桨报错原因,你也来试试?
点击左上方蓝字关注我们 [故事的开始-]小张是一名AI算法攻城狮,听闻飞桨乃国产开源深度学习框架之光,心想炎黄子孙当自强,用自己的深度学习框架,实现中国的AI梦--他尝试在的笔记本上使用飞桨搭建线性回 ...
- mtk一键usb驱动_三菱MRJEB驱动器报错,导致报错原因37.1参数设置范围异常?
三菱MR-JE-B驱动器报错,导致报错原因37.1参数设置范围异常?最近海蓝机电工程师们在做一个项目,做的是三菱MR-JE-B驱动器.工程师们在实操这个项目过程中遇到各种问题,其中就像驱动器报错的问题 ...
- AntD 官网样例 InputRef报错原因
在官网可编辑表格typescript样例里 const inputRef = useRef<InputRef>(null); InputRef项目报错原因是ant design的版本问题! ...
- IndexError: list index out of range--Python报错原因及解决办法
报错原因 一.括号里面的索引index超出范围 例如:要查找最后一个明星的名字'Hannah Quinlivan',Index输入为4.在Python中,第四个元素的索引为3,因为索引是从0开始的.如 ...
- python导入requests库一直报错原因总结_python pip 安装库文件报错:pip install ImportError: No module named _internal...
centos6,python3,通过pip安装pycurl出现报错提示 Centos6.7系统,python3.6.7,通过 pip 安装pycurl出现报错: __main__.Configurat ...
- [转]python3_unboundlocalerror报错原因
出现此错误,一般是因为,在调用的函数内,使用了外部变量造成的.这里先姑且不管你的目的是什么(可能是你想对这个外部变量进行一些赋值操作:也可能是你只是想创建一个本地变量,但是你不小心弄成和外部变量重名了 ...
- [ScyllaHide] 04 ScyllaHide配置报错原因定位
[ScyllaHide] 文章列表-看雪地址: 00 简单介绍和使用 01 项目概览 02 InjectorCLI源码分析 03 PEB相关反调试 04 ScyllaHide配置报错原因定位 05 S ...
- PostMan测试接口,出现415报错,Unsupported Media Type
PostMan测试接口,出现415报错,Unsupported Media Type 问题描述: 当用PostMan测试接口时候,出现如下报错 解决方法: 打开返回信息中的Header条框,查 ...
- Cannot assign to read only property ‘0’ of string的报错原因之一及解决办法
一. 需求场景 现有项目,需要对提交资料的人员进行审核,审核不过的时候向服务器提交数据,数据结构中的certificationStatus需为JSON格式 1.1 资料信息结构如下: auditFai ...
最新文章
- 2022-2028年中国光掩膜行业市场行情监测及未来前景规划报告
- 使用TortoiseGit,设置ssh方式连接git仓库。
- Python使用matplotlib可视化安德鲁斯曲线、安德鲁斯曲线可以用来查看分类变量对于数据集是否具有判别性、区分性(Andrews Curve)
- 网页性能优化之异步加载js文件
- Python学习:16.Python面对对象(三、反射,构造方法,静态字段,静态方法)
- java tika pdf转图片_使用tika将pdf转为html
- treelist自动定位行_国内首创!金川集团千米深井双定位补偿摇台投用
- 8位可控加减法电路设计_100以内数的认知也加减法详解
- python编写自制编译器_编译器构造-编译Python
- 计算机电力英语翻译,电力专业英语阅读与翻译..doc
- 08年最佳短篇小说《误解》
- 边缘设备上的实时AI人员检测:检测视频中的人员
- 由于连接方在一段时间后没有正确答复或连接的主机_新风换气机使用效果不佳,为何?掌握正确使用方法就好了...
- 1.2 安装 docker 容器并配置镜像加速器
- 2020年11月最新互联网大厂面试经验分享【网易、阿里、腾讯、京东、百度、爱奇艺、字节、小米、美团、搜狐、58】
- 如何使用RedisTemplate访问Redis数据结构
- signature=c7580760a679f082e2d4960e4c2c7772,Signatures of moiré-trapped valley excitons in MoSe
- 【译】如何学习机器学习
- 外星人大战---------------游戏开发(二)
- 智能云解析DNS健康监测是如何实现的?-中科三方