Skip to content

Commit

Permalink
代码优化
Browse files Browse the repository at this point in the history
  • Loading branch information
javamxd committed Jul 25, 2021
1 parent a8de9f7 commit f37acde
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ private MagicScriptContext createMagicScriptContext(RequestEntity requestEntity,
// 构建脚本上下文
MagicScriptContext context;
// TODO 安全校验
if (requestEntity.isRequestedFromDebug()) {
if (requestEntity.isRequestedFromDebug() && breakpoints.size() > 0) {
MagicScriptDebugContext debugContext = new MagicScriptDebugContext(breakpoints);
String sessionId = requestEntity.getRequestedSessionId();
debugContext.setTimeout(configuration.getDebugTimeout());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
import java.util.*;
import java.util.stream.Collectors;

import static org.ssssssss.magicapi.model.Constants.*;
import static org.ssssssss.magicapi.model.Constants.HEADER_REQUEST_BREAKPOINTS;
import static org.ssssssss.magicapi.model.Constants.HEADER_REQUEST_SESSION;

public class RequestEntity {

Expand Down Expand Up @@ -163,6 +164,7 @@ public List<Integer> getRequestedBreakpoints() {
if (breakpoints != null) {
return Arrays.stream(breakpoints.split(","))
.map(val -> ObjectConvertExtension.asInt(val, -1))
.filter(it -> it > 0)
.collect(Collectors.toList());
}
return Collections.emptyList();
Expand Down

0 comments on commit f37acde

Please sign in to comment.