DownloadResponse
Namespace: Vercel.AI.Util
public sealed class DownloadResponseOne HTTP response seen by Download.
Inheritance: object
Constructors
Section titled “Constructors”DownloadResponse(int, string?, HeaderCollection?, byte[]?, string?)
Section titled “DownloadResponse(int, string?, HeaderCollection?, byte[]?, string?)”public DownloadResponse(int status, string? statusText, HeaderCollection? headers, byte[]? body, string? type = "basic")Creates a response.
Parameters
| Name | Type | Description |
|---|---|---|
status |
int | |
statusText |
string | |
headers |
HeaderCollection | |
body |
byte[] | |
type |
string |
Properties
Section titled “Properties”public byte[]? Body { get; }Response body. May be null.
Value: byte[]
Cancelled
Section titled “Cancelled”public bool Cancelled { get; }Whether Cancel() has run.
Value: bool
Headers
Section titled “Headers”public HeaderCollection Headers { get; }Response headers.
Value: HeaderCollection
public bool Ok { get; }Whether the status is 200-299.
Value: bool
OnCancel
Section titled “OnCancel”public Action? OnCancel { get; set; }Called when the body is cancelled.
Value: Action
Status
Section titled “Status”public int Status { get; }HTTP status.
Value: int
StatusText
Section titled “StatusText”public string StatusText { get; }HTTP status text.
Value: string
public string Type { get; }basic or opaqueredirect.
Value: string
Methods
Section titled “Methods”Bytes(byte[]?, string?, int)
Section titled “Bytes(byte[]?, string?, int)”public static DownloadResponse Bytes(byte[]? body, string? mediaType, int status = 200)A successful body response.
Parameters
| Name | Type | Description |
|---|---|---|
body |
byte[] | |
mediaType |
string | |
status |
int |
Returns: DownloadResponse
Cancel()
Section titled “Cancel()”public void Cancel()Releases the body. Failures are ignored.
Text(string?, string?)
Section titled “Text(string?, string?)”public static DownloadResponse Text(string? text, string? mediaType = "text/plain")A successful UTF-8 text response.
Parameters
| Name | Type | Description |
|---|---|---|
text |
string | |
mediaType |
string |
Returns: DownloadResponse
Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product