IResponse
A thin wrapper around each host's Response e.g: ASP.NET, HttpListener, MQ, etc
Assembly: ServiceStack.Interfaces.dll
View Source
public interface IResponse
Properties
OriginalResponse
The underlying ASP.NET, .NET Core or HttpListener HttpResponse
View Source
object OriginalResponse { get; }
Request
The corresponding IRequest API for this Response
View Source
IRequest Request { get; }
StatusCode
The Response Status Code
View Source
int StatusCode { get; set; }
StatusDescription
The Response Status Description
View Source
string StatusDescription { get; set; }
ContentType
The Content-Type for this Response
View Source
string ContentType { get; set; }
OutputStream
The Response Body Output Stream
View Source
Stream OutputStream { get; }
Dto
The Response DTO
View Source
object Dto { get; set; }
UseBufferedStream
Buffer the Response OutputStream so it can be written in 1 batch
View Source
bool UseBufferedStream { get; set; }
IsClosed
Gets a value indicating whether this instance is closed.
View Source
bool IsClosed { get; }
KeepAlive
Whether the underlying TCP Connection for this Response should remain open
View Source
bool KeepAlive { get; set; }
HasStarted
Whether the HTTP Response Headers have already been written.
View Source
bool HasStarted { get; }
Items
View Source
Dictionary<string, object> Items { get; }
Methods
AddHeader(String, String)
Add a Header to this Response
View Source
void AddHeader(string name, string value)
Parameters
Type | Name |
---|---|
System.String | name |
System.String | value |
RemoveHeader(String)
Remove an existing Header added on this Response
View Source
void RemoveHeader(string name)
Parameters
Type | Name |
---|---|
System.String | name |
GetHeader(String)
Get an existing Header added to this Response
View Source
string GetHeader(string name)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | name |
Redirect(String)
Return a Redirect Response to the URL specified
View Source
void Redirect(string url)
Parameters
Type | Name |
---|---|
System.String | url |
Close()
Signal that this response has been handled and no more processing should be done. When used in a request or response filter, no more filters or processing is done on this request.
View Source
void Close()
CloseAsync(CancellationToken)
Close this Response Output Stream Async
View Source
Task CloseAsync(CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|---|
System.Threading.CancellationToken | token |
End()
Calls Response.End() on ASP.NET HttpResponse otherwise is an alias for Close(). Useful when you want to prevent ASP.NET to provide it's own custom error page.
View Source
void End()
Flush()
Response.Flush() and OutputStream.Flush() seem to have different behaviour in ASP.NET
View Source
void Flush()
FlushAsync(CancellationToken)
Flush this Response Output Stream Async
View Source
Task FlushAsync(CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|---|
System.Threading.CancellationToken | token |
SetContentLength(Int64)
Set the Content Length in Bytes for this Response
View Source
void SetContentLength(long contentLength)
Parameters
Type | Name |
---|---|
System.Int64 | contentLength |