Skip to content

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

Closed
wants to merge 5 commits into from

Conversation

moonbingbing
Copy link

fix this issue openresty/openresty#92

Copy link
Member

@doujiang24 doujiang24 left a 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");
Copy link
Member

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;
Copy link
Member

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"

Copy link
Member

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 {
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useless code here?

@moonbingbing
Copy link
Author

@doujiang24 thanks for your helpful code review. I will fix them ASAP.

@moonbingbing
Copy link
Author

I will also fix ngx.resp.get_headers :)

"failed to set default content type: %d",
(int) rc);
}
ctx->headers_set = 1;
Copy link
Member

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
Copy link
Member

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);
}

Copy link
Member

@agentzh agentzh Dec 27, 2016

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:

@agentzh
Copy link
Member

agentzh commented Dec 27, 2016

@moonbingbing I've fixed the last coding style nit and also the commit log messages :) Thanks!

@agentzh agentzh closed this Dec 27, 2016
moonming added a commit to moonming/lua-nginx-module that referenced this pull request Apr 5, 2017
moonming added a commit to moonming/lua-nginx-module that referenced this pull request Apr 5, 2017
moonming added a commit to moonming/lua-nginx-module that referenced this pull request Apr 5, 2017
agentzh pushed a commit that referenced this pull request Apr 5, 2017


Signed-off-by: Yichun Zhang (agentzh) <yichun@openresty.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants