Skip to content
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

fix: do not invoke add_header if value resolved as nil #10619

Merged
merged 1 commit into from
Dec 11, 2023

Conversation

fengxsong
Copy link
Contributor

Description

If header_value is resolved to nil or empty table, add_header will throw an error https://github.com/openresty/lua-resty-core/blob/master/lib/resty/core/request.lua#L364

It's better to do nothing.

ref: https://github.com/openresty/lua-resty-core/blob/master/lib/ngx/req.md#add_header

Checklist

  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible (If not, please discuss on the APISIX mailing list first)

@Revolyssup
Copy link
Contributor

@fengxsong Can you add some test here?

@fengxsong
Copy link
Contributor Author

@fengxsong Can you add some test here?

do we really need test case for this PR?

@Revolyssup
Copy link
Contributor

@fengxsong Can you add some test here?

do we really need test case for this PR?

A test case proving that logs have no error log in this condition might be helpful. @Sn0rt Do you have suggestions here?

@monkeyDluffy6017
Copy link
Contributor

@Revolyssup I think the code is very simple, no test cases is ok

@monkeyDluffy6017 monkeyDluffy6017 merged commit e6afb6f into apache:master Dec 11, 2023
30 checks passed
@fengxsong fengxsong deleted the patch-1 branch December 12, 2023 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants