File tree 3 files changed +23
-8
lines changed
3 files changed +23
-8
lines changed Original file line number Diff line number Diff line change @@ -14,12 +14,15 @@ def build(record)
14
14
if record . response_body
15
15
disposition = normalize_content_disposition ( record . response_content_disposition )
16
16
17
- response [ :content ] = {
18
- normalize_content_type ( record . response_content_type ) => {
19
- schema : build_property ( record . response_body , disposition : disposition ) ,
20
- example : response_example ( record , disposition : disposition ) ,
21
- } . compact ,
22
- }
17
+ has_content = !normalize_content_type ( record . response_content_type ) . nil?
18
+ if has_content
19
+ response [ :content ] = {
20
+ normalize_content_type ( record . response_content_type ) => {
21
+ schema : build_property ( record . response_body , disposition : disposition ) ,
22
+ example : response_example ( record , disposition : disposition ) ,
23
+ } . compact ,
24
+ }
25
+ end
23
26
end
24
27
25
28
{
Original file line number Diff line number Diff line change @@ -19,6 +19,13 @@ paths:
19
19
summary : get
20
20
tags :
21
21
- Page
22
+ parameters :
23
+ - name : head
24
+ in : query
25
+ required : false
26
+ schema :
27
+ type : integer
28
+ example : 1
22
29
responses :
23
30
' 200 ' :
24
31
description : return HTML
27
34
schema :
28
35
type : string
29
36
example : ' <!DOCTYPE html><html lang="en"><head><title>Hello</title></head><body>Hello</body></html>'
30
- # '204':
31
- # description: return no content
37
+ ' 204 ' :
38
+ description : return no content
32
39
" /tables " :
33
40
get :
34
41
summary : index
Original file line number Diff line number Diff line change 117
117
get '/pages'
118
118
expect ( response . status ) . to eq ( 200 )
119
119
end
120
+
121
+ it 'return no content' do
122
+ get '/pages?head=1'
123
+ expect ( response . status ) . to eq ( 204 )
124
+ end
120
125
end
121
126
end
You can’t perform that action at this time.
0 commit comments