Skip to content

Commit 43ec436

Browse files
committed
fix data-api bug
1 parent 612eeba commit 43ec436

File tree

2 files changed

+38
-3
lines changed

2 files changed

+38
-3
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Copyright 2019 WeBank
3+
* Licensed under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License.
5+
* You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software
10+
* distributed under the License is distributed on an "AS IS" BASIS,
11+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
* See the License for the specific language governing permissions and
13+
* limitations under the License.
14+
*
15+
*/
16+
package com.webank.wedatasphere.dss.data.api.server.entity;
17+
18+
19+
public class VariableString {
20+
private String path;
21+
22+
public VariableString(String unparsedPath) {
23+
this.path = unparsedPath;
24+
}
25+
26+
public String getPath() {
27+
return path;
28+
}
29+
30+
public void setPath(String path) {
31+
this.path = path;
32+
}
33+
}

dss-data-api/dss-data-api-server/src/main/java/com/webank/wedatasphere/dss/data/api/server/restful/DSSDbApiConfigRestful.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import com.webank.wedatasphere.dss.data.api.server.entity.ApiConfig;
2222
import com.webank.wedatasphere.dss.data.api.server.entity.ApiGroup;
23+
import com.webank.wedatasphere.dss.data.api.server.entity.VariableString;
2324
import com.webank.wedatasphere.dss.data.api.server.entity.response.ApiExecuteInfo;
2425
import com.webank.wedatasphere.dss.data.api.server.entity.response.ApiGroupInfo;
2526
import com.webank.wedatasphere.dss.data.api.server.exception.DataApiException;
@@ -113,11 +114,12 @@ public Message getApiDetail(@RequestParam("apiId") int apiId) {
113114
* @param map
114115
* @return
115116
*/
116-
@RequestMapping(value ="/test/{path:[a-zA-Z0-9_/]+}", method = RequestMethod.POST)
117-
public Message testApi(@Context HttpServletRequest request, @PathVariable("path") String path, @RequestBody Map<String, Object> map) {
117+
118+
@RequestMapping(value ="/test/{path:.*}", method = RequestMethod.POST)
119+
public Message testApi(@Context HttpServletRequest request, @PathVariable("path") VariableString path, @RequestBody Map<String, Object> map) {
118120

119121
try {
120-
ApiExecuteInfo resJo = apiConfigService.apiTest(path, request, map,true);
122+
ApiExecuteInfo resJo = apiConfigService.apiTest(path.getPath(), request, map,true);
121123
Message message = Message.ok().data("response", resJo);
122124
return message;
123125
} catch (Exception exception) {

0 commit comments

Comments
 (0)