Configuration options for HTTP requests

Example

const http = platform.get(PlatformServiceName.Http);
const options: HttpOptions = {
params: { search: 'John', limit: '10' },
headers: { 'X-Custom-Header': 'value' },
responseType: 'json'
};
const data = await http.get('my_addon/users', options);

Hierarchy

  • HttpOptions

Properties

headers?: HttpHeaders

Additional HTTP headers to include in the request

Example

const headers = {
'Authorization': 'Bearer token123',
'Accept-Language': 'en-US'
};
params?: HttpParams

Query parameters to append to the URL

Parameters will be URL-encoded and appended to the request URL.

Example

// Results in: my_addon/users?active=true&role=admin&role=user
const params = {
active: 'true',
role: ['admin', 'user']
};
responseType?: HttpResponseType

Expected response data type. Defaults to 'json'

  • json: Parse response as JSON (default)
  • text: Get response as plain text string
  • blob: Get response as binary Blob (for file downloads)
  • arraybuffer: Get response as ArrayBuffer (for binary data processing)

Example

// Download PDF file
const pdfBlob = await http.get('my_addon/report.pdf', {
responseType: 'blob'
});