-
Notifications
You must be signed in to change notification settings - Fork 2.1k
integrate response content-type's expected value #936
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
Conversation
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.
@moonbingbing This can also happen in ngx.req.get_headers()
, better fix it also :)
|
||
r = ngx_http_lua_get_req(L); | ||
if (r == NULL) { | ||
return luaL_error(L, "no request object found"); | ||
} | ||
|
||
ctx = ngx_http_get_module_ctx(r, ngx_http_lua_module); | ||
if (ctx == NULL) { | ||
return luaL_error(L, "no ctx"); |
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.
better use no ctx found
here :)
(int) rc); | ||
} | ||
|
||
ctx->headers_set = 1; |
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'm afraid this is wrong here, better remove this line, like this case
local content_type = ngx.header.content_type
ngx.header.foo = "foo"
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.
Sorry, it's my mistake, just forgot it:)
ngx.say(ngx.header["content-type"]) | ||
} | ||
header_filter_by_lua_block { | ||
} |
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.
useless code here?
@doujiang24 thanks for your helpful code review. I will fix them ASAP. |
I will also fix |
"failed to set default content type: %d", | ||
(int) rc); | ||
} | ||
ctx->headers_set = 1; |
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.
Style: need a blank line after }
.
|
||
|
||
|
||
=== TEST 70:always return the matched content-type |
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.
Style: need a space after the colon (:
).
"failed to set default content type: %d", | ||
(int) rc); | ||
} | ||
|
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.
This line has trailing spaces. Better use the ngx-releng
tool to check such things. For this case, ngx-releng
reports the following error (the error message was actually in red):
src/ngx_http_lua_headers.c:
found line tailing spaces
492:
@moonbingbing I've fixed the last coding style nit and also the commit log messages :) Thanks! |
fix this issue openresty/openresty#92