apisix icon indicating copy to clipboard operation
apisix copied to clipboard

fix: ext-plugin request header cannot be override

Open zxyao145 opened this issue 1 year ago • 9 comments

Description

When I use go plugin runner to set the request header, such as content-type, in apisix lua, it will become Content-Type.

And due to case sensitivity, the request header cannot be correctly replicated.

By printing the params through the log

https://github.com/apache/apisix/blob/2d47b4b3b33730b1de92c91c4fbe2b239ee339af/apisix/plugins/ext-plugin-post-resp.lua#L80-L85

it can be observed that both Content-Type and content-type can be observed simultaneously in the headers.

Fixes # (issue) https://github.com/apache/apisix-go-plugin-runner/issues/155

Checklist

  • [x] I have explained the need for this PR and the problem it solves
  • [x] 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
  • [x] I have verified that this change is backward compatible (If not, please discuss on the APISIX mailing list first)

zxyao145 avatar Jan 17 '24 14:01 zxyao145

Hi @zxyao145 could you add test cases in the PR?

lakshya8066 avatar Jan 17 '24 15:01 lakshya8066

Hi @zxyao145 could you add test cases in the PR?

Hi, I am sorry, I am not a Lua developer and not familiar with Lua. Could you provide relevant guidance?

zxyao145 avatar Jan 18 '24 01:01 zxyao145

Hi @zxyao145 could you add test cases in the PR?

Hi, I am sorry, I am not a Lua developer and not familiar with Lua. Could you provide relevant guidance?

hello!, u can check the other testcase and there are some guidance https://openresty.gitbooks.io/programming-openresty/content/testing/test-nginx.html https://github.com/openresty/test-nginx?tab=readme-ov-file#user-guide https://apisix.apache.org/zh/docs/apisix/next/internal/testing-framework/

Vacant2333 avatar Jan 18 '24 11:01 Vacant2333

Hi @zxyao145 could you add test cases in the PR?

Hi, I am sorry, I am not a Lua developer and not familiar with Lua. Could you provide relevant guidance?

hello!, u can check the other testcase and there are some guidance https://openresty.gitbooks.io/programming-openresty/content/testing/test-nginx.html https://github.com/openresty/test-nginx?tab=readme-ov-file#user-guide https://apisix.apache.org/zh/docs/apisix/next/internal/testing-framework/

@Vacant2333 Thanks! I need some time to do it.

zxyao145 avatar Jan 18 '24 12:01 zxyao145

@shreemaan-abhishek can u help him assign this issue?

Vacant2333 avatar Jan 18 '24 12:01 Vacant2333

@Vacant2333 Hi, I am not sure if there is a problem with this test as I am unable to run it locally (Windows). Could you please help me check it.

zxyao145 avatar Jan 26 '24 10:01 zxyao145

@zxyao145 maybe you can use a virtual machine?

monkeyDluffy6017 avatar Feb 01 '24 03:02 monkeyDluffy6017

@zxyao145 maybe you can use a virtual machine?

Sorry, there are no resources or conditions to create a virtual machine.

zxyao145 avatar Feb 02 '24 03:02 zxyao145

The pr won't be accepted if there are ci errors

monkeyDluffy6017 avatar Feb 04 '24 02:02 monkeyDluffy6017

I'm so sorry that I don't have extra time to solve the issue with testcase.

This PR will be closed. Thanks to everyone for their help in this PR.

zxyao145 avatar Feb 20 '24 11:02 zxyao145