Skip to content

Commit 7e978b0

Browse files
authored
Merge pull request #552 from tianlu-root/master
fix:file provider config template bug fix
2 parents fd5bff9 + 0dfa29f commit 7e978b0

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

data-providers/file-data-provider/src/main/resources/file-data-provider.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@
2525
"CSV"
2626
]
2727
},
28+
{
29+
"name": "path",
30+
"required": true,
31+
"defaultValue": "",
32+
"type": "string"
33+
},
2834
{
2935
"name": "columns",
3036
"defaultValue": "",

data-providers/http-data-provider/src/main/java/datart/data/provider/HttpDataProvider.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,12 @@ private HttpRequestParam convert2RequestParam(Map<String, Object> schema) throws
142142
if (parser != null && StringUtils.isNotBlank(parser.toString())) {
143143
parserClass = parser.toString();
144144
}
145-
146145
Class<? extends HttpResponseParser> aClass = (Class<? extends HttpResponseParser>) Class.forName(parserClass);
147-
148146
httpRequestParam.setResponseParser(aClass);
149-
150-
httpRequestParam.setBody(schema.getOrDefault(BODY, "").toString());
151-
147+
Object body = schema.get(BODY);
148+
if (body != null) {
149+
httpRequestParam.setBody(body.toString());
150+
}
152151
httpRequestParam.setQueryParam((Map<String, String>) schema.get(QUERY_PARAM));
153152

154153
httpRequestParam.setHeaders((Map<String, String>) schema.get(HEADER));

0 commit comments

Comments
 (0)