javascript - 不支持的媒体文件类型
问题描述
在使用 fetch web api 进行发布请求并传递一些带有哈希和签名的 json 数据作为标头参数时,每次执行代码错误似乎是不受支持的文件类型,但与错误相反,我的标头和正文是正确的,另外我的正文参数也不是文件,所以我很困惑这里有什么问题。请调查一下。
fetch('https://sboxapi.lazypay.in/api/lazypay/v2/payment/eligibility',{
method: 'post',
body : occFormatResponse,
header :{
'signature' : hash,
'accessKey' : merchantAccessKey,
'Content-Type': 'application/json',
}
})
.then(function(result){
console.log('result>>>>>>>',result);
// return result;
})
.catch(function(error){
console.log('error while checking the eligibiliy>>>>>>',error);
// return error.response;
})
下面是错误
{"timestamp":1559713841465,"status":415,"error":"Unsupported Media Type","path":"/api/lazypay/v2/payment/eligibility","errorCode":"LP_GENERIC_ERROR","message":"Oops!! Something went wrong"}
机身参数
{
"userDetails" : {
"firstname" : "ravi",
"lastname" : "singh",
"mobile" : "9892197128",
"email" : "ravi.singh@adapty.com"
},
"amount" : {
"value" : 1000,
"currency" : "INR"
},
"address" : {
"address1" : "street1",
"address2" : "street2",
"city" : "pune",
"state" : "MH",
"country" : "IN",
"zip" : "411045"
},
"productSkuDetails" : {
"productId" : "10537492PK",
"description" : "test product",
"attributes" : {
"size" : "S",
"color" : "blue"
},
"imageUrl" : "www.google.com",
"shippable" : true,
"skuId" : "10537492",
"price" : 1000
},
"source" : "fabindia",
"customParams": {
"previousTransactionCount": "10",
"onboardingdate": "20-05-2009",
"usersignupdetails": "Google",
"IPaddress": "10.10.10.10"
}
}
解决方案
推荐阅读
- python - 列未编码
- flutter - Flutter:ModalBottomSheet 内的 DraggableScrollable 布局不会关闭
- xslt-1.0 - 使用 XSLT 1.0 按年份分组日期列表
- javascript - 如何将数组传递给该函数并调用该函数?
- android - 如何在 AdMob、Vungle、Ironsource 和 Applovin 等广告网络中使用 GDPR 同意?
- unity3d - Unity Texture2D.ReadPixels 在 Android 上的读取方式不同
- java - 输出给我一个 NaN ,为什么?[ 完全的 ]
- express - 如何在 Express js 中检索表单数据值?
- arrays - 在对每个元素的数字求和后重建一个整数数组
- wordpress - 用于 Internet NEG 的带有 CDN 的 Google 负载平衡器,不存储和使用 CDN cace