Skip to content

Commit

Permalink
Merge pull request #75 from hahwul/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
hahwul authored Sep 5, 2023
2 parents e8cbf40 + 5f14afc commit af80b07
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion spec/functional_test/testers/go_gin_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ extected_endpoints = [
Param.new("password", "", "form"),
Param.new("User-Agent", "", "header"),
]),
Endpoint.new("/public/secret.html", "GET"),
]

FunctionalTester.new("fixtures/go_gin/", {
:techs => 1,
:endpoints => 2,
:endpoints => 3,
}, extected_endpoints).test_all
10 changes: 9 additions & 1 deletion src/analyzer/analyzers/analyzer_go_gin.cr
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class AnalyzerGoGin < Analyzer
end
end

["Query", "PostForm", "GetHeader", "Static"].each do |pattern|
["Query", "PostForm", "GetHeader"].each do |pattern|
if line.includes?("#{pattern}(")
get_param(line).tap do |param|
if param.name.size > 0 && last_endpoint.method != ""
Expand All @@ -29,6 +29,14 @@ class AnalyzerGoGin < Analyzer
end
end
end

if line.includes?("Static(")
get_static_path(line).tap do |static_path|
if static_path["static_path"].size > 0 && static_path["file_path"].size > 0
public_dirs << static_path
end
end
end
end
end
end
Expand Down

0 comments on commit af80b07

Please sign in to comment.