Eve with Postman "must be of list type" 错误
Eve with Postman "must be of list type" error
我有一个这样设置的前夜模式:
schema = {
"month": {
"type": "datetime",
"required": True,
},
"test": {
"type": "list"
},
}
我正在使用 postman 发出 post 请求:
对于为什么会出现此错误,我有点不知所措,我是否遗漏了一些明显的东西?这不是为 postman/eve 格式化列表的正确方法吗?
其他字段工作正常,日期时间、字符串、整数等。但是一旦我尝试 post 列表,无论我做什么我都会收到此错误。
如果您使用 form-data
body 检查 Postman 发送的请求,您可以看到 body 与此类似:
------WebKitFormBoundarynhX0dI6JZNPzq8AK
Content-Disposition: form-data; name="month"
2017-08-01T00:00:00
------WebKitFormBoundarynhX0dI6JZNPzq8AK
Content-Disposition: form-data; name="test"
[1,2,3,4,5,6,7]
------WebKitFormBoundarynhX0dI6JZNPzq8AK--
使用来自 Postman 的原始 body,并将 Request-header Content-type
设置为 application/json
,它是这样的,适用于 eve:
{
"month": "2017-08-01T00:00:00",
"test": [1,2,3,4,5,6,7]
}
我无法很好地解释原因,但这就是我如何让它与 pyeve 一起工作的。
我有一个这样设置的前夜模式:
schema = {
"month": {
"type": "datetime",
"required": True,
},
"test": {
"type": "list"
},
}
我正在使用 postman 发出 post 请求:
对于为什么会出现此错误,我有点不知所措,我是否遗漏了一些明显的东西?这不是为 postman/eve 格式化列表的正确方法吗?
其他字段工作正常,日期时间、字符串、整数等。但是一旦我尝试 post 列表,无论我做什么我都会收到此错误。
如果您使用 form-data
body 检查 Postman 发送的请求,您可以看到 body 与此类似:
------WebKitFormBoundarynhX0dI6JZNPzq8AK
Content-Disposition: form-data; name="month"
2017-08-01T00:00:00
------WebKitFormBoundarynhX0dI6JZNPzq8AK
Content-Disposition: form-data; name="test"
[1,2,3,4,5,6,7]
------WebKitFormBoundarynhX0dI6JZNPzq8AK--
使用来自 Postman 的原始 body,并将 Request-header Content-type
设置为 application/json
,它是这样的,适用于 eve:
{
"month": "2017-08-01T00:00:00",
"test": [1,2,3,4,5,6,7]
}
我无法很好地解释原因,但这就是我如何让它与 pyeve 一起工作的。