[英]RESTHeart Error When Trying To Load CSV Data
I try to load csv data by using:我尝试使用以下方法加载 csv 数据:
given().
contentType("text/csv").
body("num,name,val\n1,dror,x\n2,amir,y").
when().
log ().
all ().
post("csv?db=restheart&coll=poi&id=0").
then().log().ifError()
I get status 400:我得到状态 400:
"message": "Content-Type request header must be 'text/csv'"
although the header seems right:尽管 header 似乎是正确的:
Content-Type=text/csv; charset=ISO-8859-1
full log following:完整日志如下:
Request path: http://localhost:8080/csv?db=restheart&coll=poi&id=0
Proxy: <none>
Request params: <none>
Query params: <none>
Form params: <none>
Path params: <none>
Multiparts: <none>
Headers: Accept=*/*
Content-Type=text/csv; charset=ISO-8859-1
Cookies: <none>
Body:
num,name,val
1,dror,x
2,amir,y
HTTP/1.1 400 Bad Request
Content-Encoding: gzip
X-Powered-By: restheart.org
Auth-Token-Location: /tokens/admin
Authentication-Info: nextnonce="moqjKcH05wkNMTU4NTk1NDY2OTEwNe2jU1Xuay1TK5O7rrmyiDA=",qop="auth",rspauth="d31b66e99f7dbb1c339b17741f9380c5",cnonce="f1843d31ec429268",nc=00000001
Access-Control-Expose-Headers: Location, ETag, X-Powered-By, Auth-Token, Auth-Token-Valid-Until, Auth-Token-Location
Date: Fri, 03 Apr 2020 22:57:49 GMT
Auth-Token: 16p0go30vzwa3ju0h839zn4wfnipcy914g56b5t0xkjh9yotxa
Connection: keep-alive
Access-Control-Allow-Origin: *
Auth-Token-Valid-Until: 2020-04-03T23:12:49.109466Z
Access-Control-Allow-Credentials: true
Content-Type: application/json
Content-Length: 142
{
"http status code": 400,
"http status description": "Bad Request",
"message": "Content-Type request header must be 'text/csv'",
"_links": {
"self": {
"href": "/csv"
}
}
}
Any idea what is going wrong?知道出了什么问题吗?
I checked the code of the CsvLoader service (that handles the request) and it checks Content-Type to be exactly text/csv
, so I think the problem is with the additional charset substring ; charset=ISO-8859-1
我检查了 CsvLoader 服务的代码(处理请求),它检查 Content-Type 是否完全是
text/csv
,所以我认为问题出在附加字符集 substring ; charset=ISO-8859-1
; charset=ISO-8859-1
Force the Content-Type header to be exactly just text-cvs
.强制 Content-Type header 正好是
text-cvs
。
I also fixed this bug (see commit 47fa0821 ).我还修复了这个错误(参见提交 47fa0821 )。 Fix will be included in upcoming v5.0 release.
修复将包含在即将发布的 v5.0 版本中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.