-
Notifications
You must be signed in to change notification settings - Fork 181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
new ljpack encode #109
base: master
Are you sure you want to change the base?
new ljpack encode #109
Conversation
@@ -47,6 +47,11 @@ function Response:json(data, empty_table_as_object) | |||
self:_send(utils.json_encode(data, empty_table_as_object)) | |||
end | |||
|
|||
function Response:ljpack(data) | |||
self:set_header('Content-Type', 'application/ljpack') | |||
self:__send(utils.ljpack_encode(data)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's enough to call the already existing self:_send
directly.
function Response:__send(content) | ||
ngx.status = self.http_status or 200 | ||
ngx.print(content) | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
@@ -8,6 +8,7 @@ local sgsub = string.gsub | |||
local smatch = string.match | |||
local table_insert = table.insert | |||
local json = require("cjson") | |||
local st = require("string.buffer") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the new api string.buffer
was introduced from OpenResty 1.12.4.1 onwards, it would be nice to have a fallback to be compatible with older versions of OpenResty.
No description provided.