Skip to content
DocsTry Aspire
DocsTry

ResponseTransformExtensions Methods

ClassMethods8 members
Extensions for adding response header and trailer transforms.
WithTransformCopyResponseHeaders(YarpRoute, bool)Section titled WithTransformCopyResponseHeaders(YarpRoute, bool)extensionYarpRoute
Adds the transform which will enable or suppress copying response headers to the client response.
public static class ResponseTransformExtensions
{
public static YarpRoute WithTransformCopyResponseHeaders(
this YarpRoute route,
bool copy = true)
{
// ...
}
}
copybooloptional
WithTransformCopyResponseTrailers(YarpRoute, bool)Section titled WithTransformCopyResponseTrailers(YarpRoute, bool)extensionYarpRoute
Adds the transform which will enable or suppress copying response trailers to the client response.
public static class ResponseTransformExtensions
{
public static YarpRoute WithTransformCopyResponseTrailers(
this YarpRoute route,
bool copy = true)
{
// ...
}
}
copybooloptional
WithTransformResponseHeader(YarpRoute, string, string, bool, ResponseCondition)Section titled WithTransformResponseHeader(YarpRoute, string, string, bool, ResponseCondition)extensionYarpRoute
Adds the transform which will append or set the response header.
public static class ResponseTransformExtensions
{
public static YarpRoute WithTransformResponseHeader(
this YarpRoute route,
string headerName,
string value,
bool append = true,
ResponseCondition condition = ResponseCondition.Success)
{
// ...
}
}
headerNamestring
valuestring
appendbooloptional
conditionResponseConditionoptional
WithTransformResponseHeaderRemove(YarpRoute, string, ResponseCondition)Section titled WithTransformResponseHeaderRemove(YarpRoute, string, ResponseCondition)extensionYarpRoute
Adds the transform which will remove the response header.
public static class ResponseTransformExtensions
{
public static YarpRoute WithTransformResponseHeaderRemove(
this YarpRoute route,
string headerName,
ResponseCondition condition = ResponseCondition.Success)
{
// ...
}
}
headerNamestring
conditionResponseConditionoptional
WithTransformResponseHeadersAllowed(YarpRoute, string[])Section titled WithTransformResponseHeadersAllowed(YarpRoute, string[])extensionYarpRoute
Adds the transform which will only copy the allowed response headers. Other transforms that modify or append to existing headers may be affected if not included in the allow list.
public static class ResponseTransformExtensions
{
public static YarpRoute WithTransformResponseHeadersAllowed(
this YarpRoute route,
params string[] allowedHeaders)
{
// ...
}
}
allowedHeadersstring[]
WithTransformResponseTrailer(YarpRoute, string, string, bool, ResponseCondition)Section titled WithTransformResponseTrailer(YarpRoute, string, string, bool, ResponseCondition)extensionYarpRoute
Adds the transform which will append or set the response trailer.
public static class ResponseTransformExtensions
{
public static YarpRoute WithTransformResponseTrailer(
this YarpRoute route,
string headerName,
string value,
bool append = true,
ResponseCondition condition = ResponseCondition.Success)
{
// ...
}
}
headerNamestring
valuestring
appendbooloptional
conditionResponseConditionoptional
WithTransformResponseTrailerRemove(YarpRoute, string, ResponseCondition)Section titled WithTransformResponseTrailerRemove(YarpRoute, string, ResponseCondition)extensionYarpRoute
Adds the transform which will remove the response trailer.
public static class ResponseTransformExtensions
{
public static YarpRoute WithTransformResponseTrailerRemove(
this YarpRoute route,
string headerName,
ResponseCondition condition = ResponseCondition.Success)
{
// ...
}
}
headerNamestring
conditionResponseConditionoptional
WithTransformResponseTrailersAllowed(YarpRoute, string[])Section titled WithTransformResponseTrailersAllowed(YarpRoute, string[])extensionYarpRoute
Adds the transform which will only copy the allowed response trailers. Other transforms that modify or append to existing trailers may be affected if not included in the allow list.
public static class ResponseTransformExtensions
{
public static YarpRoute WithTransformResponseTrailersAllowed(
this YarpRoute route,
params string[] allowedHeaders)
{
// ...
}
}
allowedHeadersstring[]