PhpStorm 2021.3 Help

HTTP Response reference

The response object holds the information about a received HTTP Response (response content, headers, status, and so on) and provides access to the headers and contentType nested objects.

Properties

Property

Description

body (string|object)

Response content, which is a string or a JSON object if the response's content-type is application/json.

headers (ResponseHeaders)

The response headers storage object.

status (int)

Response status, for example, 200 or 404.

contentType (ContentType)

The contentType object, which holds the data on the Content-Type response header value.

Headers object

The ResponseHeaders object is used for retrieving the data about response headers' values.

Methods

Method

Parameters

Description

valueOf

headerName (string)

Retrieves the first value of the headerName response header or null if the headerName response header does not exist.

valuesOf

headerName (string)

Retrieves the array containing all values of the headerName response header. Returns an empty array if the headerName response header does not exist.

ContentType object

The ContentType data object contains information from the Content-Type response header.

Properties

Property

Description

mimeType (string)

The MIME type of the response, for example, text/plain, text/xml, application/json.

charset (string)

The string representation of the response charset, for example, utf-8.

Last modified: 19 May 2021