File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -99,8 +99,8 @@ func getPathParams(path string) []string {
99
99
// titleLevel 标题的级别,0-6:
100
100
// 如果取值为 0,表示以列表的形式输出,并忽略 detail 字段的内容。
101
101
// 1-6 表示输出 detail 内容,并且将 type 和 title 作为标题;
102
- func MarkdownProblems (s web.Server , titleLevel int , detail bool ) web.LocaleStringer {
103
- if detail {
102
+ func MarkdownProblems (s web.Server , titleLevel int ) web.LocaleStringer {
103
+ if titleLevel != 0 {
104
104
return markdownProblemsWithDetail (s , titleLevel )
105
105
} else {
106
106
return markdownProblemsWithoutDetail (s )
Original file line number Diff line number Diff line change @@ -54,13 +54,13 @@ func TestMarkdownProblems(t *testing.T) {
54
54
ss := newServer (a )
55
55
p := ss .Locale ().NewPrinter (language .SimplifiedChinese )
56
56
57
- txt := MarkdownProblems (ss , 2 , true )
57
+ txt := MarkdownProblems (ss , 2 )
58
58
lines := strings .Split (txt .LocaleString (p ), "\n \n " )
59
59
a .Equal (lines [0 ], "## 400 Bad Request" ).
60
60
Equal (lines [1 ], "表示客户端错误,比如,错误的请求语法、无效的请求消息帧或欺骗性的请求路由等,服务器无法或不会处理该请求。" ).
61
61
Equal (lines [2 ], "## 401 Unauthorized" )
62
62
63
- txt = MarkdownProblems (ss , 3 , false )
63
+ txt = MarkdownProblems (ss , 0 )
64
64
lines = strings .Split (txt .LocaleString (p ), "\n \n " )
65
65
a .Equal (lines [0 ], "- 400: Bad Request" ).
66
66
Equal (lines [1 ], "- 401: Unauthorized" )
You can’t perform that action at this time.
0 commit comments