Table of Contents

Class APIRequestContextOptions

Namespace
Microsoft.Playwright
Assembly
Microsoft.Playwright.dll
public class APIRequestContextOptions
Inheritance
APIRequestContextOptions
Inherited Members

Constructors

APIRequestContextOptions()

public APIRequestContextOptions()

APIRequestContextOptions(APIRequestContextOptions)

public APIRequestContextOptions(APIRequestContextOptions clone)

Parameters

clone APIRequestContextOptions

Properties

Data

Allows to set post data of the request. If the data parameter is an object, it will be serialized to json string and content-type header will be set to application/json if not explicitly set. Otherwise the content-type header will be set to application/octet-stream if not explicitly set.

[JsonPropertyName("data")]
public string? Data { get; set; }

Property Value

string

DataByte

Allows to set post data of the request. If the data parameter is an object, it will be serialized to json string and content-type header will be set to application/json if not explicitly set. Otherwise the content-type header will be set to application/octet-stream if not explicitly set.

[JsonPropertyName("dataByte")]
public byte[]? DataByte { get; set; }

Property Value

byte[]

DataObject

Allows to set post data of the request. If the data parameter is an object, it will be serialized to json string and content-type header will be set to application/json if not explicitly set. Otherwise the content-type header will be set to application/octet-stream if not explicitly set.

[JsonPropertyName("dataObject")]
public object? DataObject { get; set; }

Property Value

object

DataString

Allows to set post data of the request. If the data parameter is an object, it will be serialized to json string and content-type header will be set to application/json if not explicitly set. Otherwise the content-type header will be set to application/octet-stream if not explicitly set.

[JsonPropertyName("dataString")]
public string? DataString { get; set; }

Property Value

string

FailOnStatusCode

Whether to throw on response codes other than 2xx and 3xx. By default response object is returned for all status codes.

[JsonPropertyName("failOnStatusCode")]
public bool? FailOnStatusCode { get; set; }

Property Value

bool?

Form

Provides an object that will be serialized as html form using application/x-www-form-urlencoded encoding and sent as this request body. If this parameter is specified content-type header will be set to application/x-www-form-urlencoded unless explicitly provided.

An instance of IFormData can be created via CreateFormData().

[JsonPropertyName("form")]
public IFormData? Form { get; set; }

Property Value

IFormData

Headers

Allows to set HTTP headers. These headers will apply to the fetched request as well as any redirects initiated by it.

[JsonPropertyName("headers")]
public IEnumerable<KeyValuePair<string, string>>? Headers { get; set; }

Property Value

IEnumerable<KeyValuePair<string, string>>

IgnoreHTTPSErrors

Whether to ignore HTTPS errors when sending network requests. Defaults to false.

[JsonPropertyName("ignoreHTTPSErrors")]
public bool? IgnoreHTTPSErrors { get; set; }

Property Value

bool?

MaxRedirects

Maximum number of request redirects that will be followed automatically. An error will be thrown if the number is exceeded. Defaults to 20. Pass 0 to not follow redirects.

[JsonPropertyName("maxRedirects")]
public int? MaxRedirects { get; set; }

Property Value

int?

Method

If set changes the fetch method (e.g. PUT or POST). If not specified, GET method is used.

[JsonPropertyName("method")]
public string? Method { get; set; }

Property Value

string

Multipart

Provides an object that will be serialized as html form using multipart/form-data encoding and sent as this request body. If this parameter is specified content-type header will be set to multipart/form-data unless explicitly provided. File values can be passed as file-like object containing file name, mime-type and its content.

An instance of IFormData can be created via CreateFormData().

[JsonPropertyName("multipart")]
public IFormData? Multipart { get; set; }

Property Value

IFormData

Params

Query parameters to be sent with the URL.

[JsonPropertyName("params")]
public IEnumerable<KeyValuePair<string, object>>? Params { get; set; }

Property Value

IEnumerable<KeyValuePair<string, object>>

Timeout

Request timeout in milliseconds. Defaults to 30000 (30 seconds). Pass 0 to disable timeout.

[JsonPropertyName("timeout")]
public float? Timeout { get; set; }

Property Value

float?