diff --git a/gateway/conf.d/apicast.conf b/gateway/conf.d/apicast.conf index 83d7fca4d..9c9fd5d47 100644 --- a/gateway/conf.d/apicast.conf +++ b/gateway/conf.d/apicast.conf @@ -1,7 +1,7 @@ set_by_lua $user_agent 'return require("apicast.user_agent")()'; set_by_lua_block $deployment { local user_agent = require('apicast.user_agent') - return user_agent.platform() .. '+' .. user_agent.deployment() + return string.format('%s+%s', user_agent.platform(), user_agent.deployment()) } # TODO: enable in the future when we support SSL diff --git a/gateway/src/apicast/user_agent.lua b/gateway/src/apicast/user_agent.lua index 21decf353..bb170867b 100644 --- a/gateway/src/apicast/user_agent.lua +++ b/gateway/src/apicast/user_agent.lua @@ -2,6 +2,7 @@ local ffi = require 'ffi' local env = require 'resty.env' local setmetatable = setmetatable +local format = string.format local _M = { _VERSION = require('apicast.version') @@ -15,7 +16,7 @@ end -- User-Agent: Mozilla/ () () function _M.call() - return 'APIcast/' .. _M._VERSION .. ' (' .. _M.system_information() .. ') ' .. (_M.platform() or '') + return format('APIcast/%s (%s) %s', _M._VERSION, _M.system_information(), _M.platform() or 'Unknown') end function _M.system_information()