Skip to content

HttpResponse body infrastructure changes #14832

Closed
@BrennanConroy

Description

@BrennanConroy

HttpResponse body infrastructure changes

The infrastructure backing HttpResponse bodies has changed. If you're using HttpResponse directly you should not need to make any code changes. Read further if you were wrapping or replacing HttpResponse.Body or accessing HttpContext.Features.

Version introduced

3.0

Old behavior

There were three APIs associated with the response body: IHttpResponseFeature.Body, IHttpSendFileFeature.SendFileAsync, and IHttpBufferingFeature.DisableResponseBuffering

New behavior

In ASP.NET Core if you replace HttpResponse.Body it will now replace the entire IHttpResponseBodyFeature with a wrapper around your given stream using StreamResponseBodyFeature to provide default implementations for all of the expected APIs. Setting back the original stream will undo this change.

Reason for change

Consolidating the response body APIs onto a single new feature interface.

Recommended action

Use IHttpResponseBodyFeature where you previously were using IHttpResponseFeature.Body,
IHttpSendFileFeature, or IHttpBufferingFeature.

Category

ASP.NET Core

Affected APIs

IHttpResponseFeature.Body
IHttpSendFileFeature
IHttpBufferingFeature


Issue metadata

  • Issue type: breaking-change

Metadata

Metadata

Assignees

Labels

breaking-changeIndicates a .NET Core breaking change

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions