我的 Controller 中有这个 dto 可供请求
@Data
public class OldTransactionFilterDto {
List<Long> ids;
List<Integer> depositConfirmationNumbers;
List<Long> lenderIds;
LocalDate transactionDateFrom;
LocalDate transactionDateTo;
List<TransactionTypes> types;
Integer offset;
Integer limit;
}
我尝试在 Postman 中执行的 json 请求如下所示
{
"ids" : [1],
"depositConfirmationNumbers" : [0],
"lenderIds" : [2],
"transactionDateFrom" : "2014-01-01",
"transactionDateTo" : "2019-01-01",
{"types" : ["Morgage"]},
"offset" : 1,
"limit" : 1
}
TransactionTypes 是只有一个值的枚举。在此 json 中, postman 说我的类型值上有错误字符串。
最佳答案
JSON 无效
{
"ids" : [1],
"depositConfirmationNumbers" : [0],
"lenderIds" : [2],
"transactionDateFrom" : "2014-01-01",
"transactionDateTo" : "2019-01-01",
{"types" : ["Morgage"]} --->here!,
"offset" : 1,
"limit" : 1
}
必须写成
{
"ids" : [1],
"depositConfirmationNumbers" : [0],
"lenderIds" : [2],
"transactionDateFrom" : "2014-01-01",
"transactionDateTo" : "2019-01-01",
"types" : ["Morgage"],
"offset" : 1,
"limit" : 1
}
正确设置 JSON,错误就会消失!
关于java - postman 请求不正确 - 错误字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60736619/