Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.6.7
3.1.0
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ gemspec
rails_version = ENV['RAILS_VERSION'] || '6.0.2'

gem 'activesupport', "~> #{rails_version}"
gem 'rack'
gem 'rexml'
2 changes: 1 addition & 1 deletion lib/dox/printers/example_request_printer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def add_schema(body, path)
end

def find_headers(headers)
headers.find { |key, _| key == 'Accept' }&.last || 'any'
headers.find { |key, _| key == 'Content-Type' }&.last || 'any'
end

def acquire_header_params
Expand Down
20 changes: 20 additions & 0 deletions spec/fixtures/example.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
"name": "Accept",
"in": "header",
"example": "application/json"
},
{
"name": "Content-Type",
"in": "header",
"example": "application/json"
}
],
"responses": {
Expand Down Expand Up @@ -61,6 +66,11 @@
"name": "Accept",
"in": "header",
"example": "application/json"
},
{
"name": "Content-Type",
"in": "header",
"example": "application/json"
}
],
"requestBody": {
Expand Down Expand Up @@ -132,6 +142,11 @@
"name": "Accept",
"in": "header",
"example": "application/json"
},
{
"name": "Content-Type",
"in": "header",
"example": "application/json"
}
],
"responses": {
Expand Down Expand Up @@ -176,6 +191,11 @@
"name": "Accept",
"in": "header",
"example": "application/json"
},
{
"name": "Content-Type",
"in": "header",
"example": "application/json"
}
],
"responses": {
Expand Down
8 changes: 4 additions & 4 deletions spec/formatter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
path: '/pokemons/14',
fullpath: '/pokemons/14',
path_parameters: { id: 14 },
headers: { 'Accept' => 'application/json' }
headers: { 'Accept' => 'application/json', 'Content-Type' => 'application/json' }
},
response: {
status: 200,
Expand Down Expand Up @@ -64,7 +64,7 @@
}
}
},
headers: { 'Accept' => 'application/json' }
headers: { 'Accept' => 'application/json', 'Content-Type' => 'application/json' }
},
response: {
status: 201,
Expand Down Expand Up @@ -97,7 +97,7 @@
method: 'get',
path: '/digimons',
fullpath: '/digimons',
headers: { 'Accept' => 'application/json' }
headers: { 'Accept' => 'application/json', 'Content-Type' => 'application/json' }
},
response: {
status: 200,
Expand Down Expand Up @@ -139,7 +139,7 @@
method: 'get',
path: '/auth',
fullpath: '/auth',
headers: { 'Accept' => 'application/json' }
headers: { 'Accept' => 'application/json', 'Content-Type' => 'application/json' }
},
response: {
status: 200,
Expand Down
2 changes: 1 addition & 1 deletion spec/printers/example_request_printer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
)
end

let(:req_headers) { { 'Accept' => content_type } }
let(:req_headers) { { 'Content-Type' => content_type, 'Accept' => content_type } }

before do
Dox.config.headers_whitelist = nil
Expand Down