mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-07 19:08:52 +00:00
udpate ruby api client to support user-agent
This commit is contained in:
parent
c109c11bea
commit
02283fae46
@ -3,7 +3,7 @@ module Swagger
|
|||||||
class Configuration
|
class Configuration
|
||||||
require 'swagger/version'
|
require 'swagger/version'
|
||||||
|
|
||||||
attr_accessor :format, :api_key, :username, :password, :auth_token, :scheme, :host, :base_path, :user_agent, :logger, :inject_format, :force_ending_format, :camelize_params
|
attr_accessor :format, :api_key, :username, :password, :auth_token, :scheme, :host, :base_path, :user_agent, :logger, :inject_format, :force_ending_format, :camelize_params, :user_agent
|
||||||
|
|
||||||
# Defaults go in here..
|
# Defaults go in here..
|
||||||
def initialize
|
def initialize
|
||||||
@ -11,7 +11,7 @@ module Swagger
|
|||||||
@scheme = 'http'
|
@scheme = 'http'
|
||||||
@host = 'api.wordnik.com'
|
@host = 'api.wordnik.com'
|
||||||
@base_path = '/v4'
|
@base_path = '/v4'
|
||||||
@user_agent = "ruby-#{Swagger::VERSION}"
|
@user_agent = "ruby-swagger-#{Swagger::VERSION}"
|
||||||
@inject_format = true
|
@inject_format = true
|
||||||
@force_ending_format = false
|
@force_ending_format = false
|
||||||
@camelize_params = true
|
@camelize_params = true
|
||||||
@ -19,4 +19,4 @@ module Swagger
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -19,7 +19,8 @@ module Swagger
|
|||||||
# Set default headers
|
# Set default headers
|
||||||
default_headers = {
|
default_headers = {
|
||||||
'Content-Type' => "application/#{attributes[:format].downcase}",
|
'Content-Type' => "application/#{attributes[:format].downcase}",
|
||||||
:api_key => Swagger.configuration.api_key
|
:api_key => Swagger.configuration.api_key,
|
||||||
|
'User-Agent' => Swagger.configuration.user_agent
|
||||||
}
|
}
|
||||||
|
|
||||||
# api_key from headers hash trumps the default, even if its value is blank
|
# api_key from headers hash trumps the default, even if its value is blank
|
||||||
|
Loading…
Reference in New Issue
Block a user