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

add: remove_http_request_header convenient func #256

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

itsLucario
Copy link

@itsLucario itsLucario commented Aug 28, 2024

This is a convenient method to remove request header by key than using set_http_request_header with empty value. Since we already have the things in place, it's just about exposing it for usage with HttpContext.

Copy link

google-cla bot commented Aug 28, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

}
}
}

Copy link
Member

Choose a reason for hiding this comment

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

Style: Could you move it above, so that it's not in-between set_map_value and set_map_value_bytes?

Ideally, could you group it with the extern C prototype, so that it's:

extern "C" {
    fn proxy_remove_header_map_value(
    [...]
}

pub fn remove_map_value(map_type: MapType, key: &str) -> Result<(), Status> {
[...]

extern "C" {
    fn proxy_replace_header_map_value(
    [...]
}

pub fn set_map_value(map_type: MapType, key: &str, value: Option<&str>) -> Result<(), Status> {
[...]

to match the existing style in this file?

Copy link
Member

Choose a reason for hiding this comment

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

Nit: The remove group should be before set group, since the latter is using proxy_remove_header_map_value, which is now used before declaration.

@@ -351,6 +351,10 @@ pub trait HttpContext: Context {
hostcalls::add_map_value_bytes(MapType::HttpRequestHeaders, name, value).unwrap()
}

fn remove_http_request_header(&self, name: &str) {
Copy link
Member

Choose a reason for hiding this comment

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

Could you add those for request trailer, response header and response trailer as well? Thanks!

Copy link
Member

Choose a reason for hiding this comment

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

Friendly ping.

Signed-off-by: Nandan B N <[email protected]>
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.

2 participants