Skip to content

Commit b58a025

Browse files
committed
Support custom headers
1 parent 8ceaa53 commit b58a025

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

app/views/grape_swagger_rails/application/index.html.erb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
apiKey: "<%= GrapeSwaggerRails.apiKey %>",
1313
dom_id:"swagger-ui-container",
1414
supportHeaderParams: true,
15+
headers: "<%= GrapeSwaggerRails.headers.to_json %>",
1516
supportedSubmitMethods: ['get', 'post', 'put'],
1617
onComplete: function(swaggerApi, swaggerUi){
1718
if(console) {

lib/grape-swagger-rails.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
require "grape-swagger-rails/engine"
22

33
module GrapeSwaggerRails
4-
mattr_accessor :discoveryUrl, :apiKey
4+
mattr_accessor :discoveryUrl, :apiKey, :headers
55

66
self.discoveryUrl = '/swagger_doc.json'
77
self.apiKey = 'special-key'
8+
self.headers = {}
89

910
end
1011

0 commit comments

Comments
 (0)