-
Notifications
You must be signed in to change notification settings - Fork 842
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 Helper Methods for adding Transform at Runtime #317
Comments
This is right in line with #60, though a big part of that one is to let you define new custom transforms as well. |
If you want to contribute this - lets schedule an ad-hoc design meeting before working on the PR. Ping me to get that setup. |
@samsp-msft yeah, I would like to contribute this. |
For adding Transforms with parameters, we could either have two separate methods for each or use an Enum in input. public static void AddSetRequestHeaderTransform(this ProxyRoute proxyRoute, string headerName, string value)
{
proxyRoute.Transforms.Add(new Dictionary<string, string>
{
["RequestHeader"] = headerName,
["Set"] = value
});
}
public static void AddAppendRequestHeaderTransform(this ProxyRoute proxyRoute, string headerName, string value)
{
proxyRoute.Transforms.Add(new Dictionary<string, string>
{
["RequestHeader"] = headerName,
["Append"] = value
});
} 2. Multiple parameters public static void AddSetRequestHeaderTransform(this ProxyRoute proxyRoute, string headerName, string value, TransformHeaderType transformHeaderType)
{
var type = transformHeaderType switch
{
TransformHeaderType.Set => "Set",
TransformHeaderType.Append => "Append",
_ => throw new System.ArgumentException(nameof(transformHeaderType));
};
proxyRoute.Transforms.Add(new Dictionary<string, string>
{
["RequestHeader"] = headerName,
[type] = value
});
} Which one do you prefer? |
I'd prefer multiple overloads (option 1), that avoids introducing more enum types that aren't widely used. Alternatively it could be a bool parameter, that's what we use for the internal implementation. reverse-proxy/src/ReverseProxy/Service/RuntimeModel/Transforms/RequestHeaderValueTransform.cs Line 18 in 24c0c5a
|
What should we add or change to make your life better?
Add helper methods for each
Transform
.Why is this important to you?
This methods can be used in
IProxyConfigFilter
.The text was updated successfully, but these errors were encountered: