-
Notifications
You must be signed in to change notification settings - Fork 894
Open
Labels
Type: BugSomething isn't workingSomething isn't working
Milestone
Description
Describe the bug
In v2.2.0 we had following code of custom transform
public override async Task ApplyRequestTransform(RequestTransformContext requestContext)
{
requestContext.ProxyRequest.Content = new StringContent(body, Encoding.UTF8, contentType);
}
After upgrade to v2.3.0, we can't use this code anymore due to new exception that is being thrown (See #2722).
I'm trying following logic to make it work, but no luck. Downstream service receives empty body.
var bodyBytes = Encoding.UTF8.GetBytes(body);
requestContext.HttpContext.Request.Body = new MemoryStream(bodyBytes);
requestContext.HttpContext.Request.Headers.ContentLength = bodyBytes.Length;
requestContext.ProxyRequest.Content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue(contentType);
I am not able to find a workaround for this :(
To Reproduce
Just transform GET
request to POST
with body
- Make a request transform that converts
GET
request toPOST
setting new body. - Downstream service will receive empty body.
Further technical details
- Yarp 2.3.0
Metadata
Metadata
Assignees
Labels
Type: BugSomething isn't workingSomething isn't working