fix: API 数据源

This commit is contained in:
taojinlong 2022-02-22 11:51:43 +08:00
parent cada5707d6
commit ea1b00ad9c
2 changed files with 2 additions and 4 deletions

View File

@ -13,7 +13,7 @@ public class ApiDefinitionRequest {
@Data @Data
public class AuthManager{ public static class AuthManager{
private String password; private String password;
private String username; private String username;
private String verification = ""; private String verification = "";

View File

@ -124,7 +124,6 @@ public class ApiProvider extends DatasourceProvider{
String response = ""; String response = "";
HttpClientConfig httpClientConfig = new HttpClientConfig(); HttpClientConfig httpClientConfig = new HttpClientConfig();
ApiDefinitionRequest apiDefinitionRequest = JSONObject.parseObject(apiDefinition.getRequest(), ApiDefinitionRequest.class); ApiDefinitionRequest apiDefinitionRequest = JSONObject.parseObject(apiDefinition.getRequest(), ApiDefinitionRequest.class);
System.out.println(new Gson().toJson(apiDefinitionRequest.getAuthManager()));
//headers //headers
for (JSONObject header : apiDefinitionRequest.getHeaders()) { for (JSONObject header : apiDefinitionRequest.getHeaders()) {
if(StringUtils.isNotEmpty(header.getString("name")) && StringUtils.isNotEmpty(header.getString("value"))){ if(StringUtils.isNotEmpty(header.getString("name")) && StringUtils.isNotEmpty(header.getString("value"))){
@ -174,7 +173,6 @@ public class ApiProvider extends DatasourceProvider{
default: default:
break; break;
} }
System.out.println("response: " + response);
return response; return response;
} }
@ -187,7 +185,7 @@ public class ApiProvider extends DatasourceProvider{
int i = 0; int i = 0;
while (it.hasNext()){ while (it.hasNext()){
Map.Entry entry = (Map.Entry)it.next(); Map.Entry entry = (Map.Entry)it.next();
row[i] = entry.getValue().toString(); row[i] = Optional.ofNullable(entry.getValue()).orElse("").toString();
i++; i++;
} }
dataList.add(row); dataList.add(row);