Method HttpRequestMessage() :setAcceptType() Foundation

Defines the accepted content type for responses from the server.

Syntax
 
:setAcceptType( <cMIMEType> | <aMIMETypes> ) --> self
Parameters
<cMIMEType>
A character string specifying the content type. The string must contain one of the standardized MIME (Multipurpose Internet Mail Extension) types. A MIME type generally has the form "type/subtype". Examples are "text/html", "image/jpeg" or "application/octet-stream". A full list of the offical MIME types currently registered is available here: https://www.iana.org/assignments/media-types/media-types.xhtml.
<aMIMETypes>
An array of content types as described for the <cMIMEType> parameter. The elements in the array can optionally be weighted by using a so-called quality value. The quality value is a value between 0 and 1 denoting the type's priority. A weight value of 1 (the default) is equivalent to the highest priority.
Example: :setAcceptType( {"text/html; q=1.0", "text/*; q=0.8"} )
Return

:setAcceptType() returns the object executing the method.

Description

The method :setAcceptType() specifies to the server which content types are supported by the client for the data sent by the server.

The accepted content type is a discretionary element in the request header. The "Content-Type" HTTP header in the server's response should be checked prior to processing the response data. See the method :getHeaders() for further information.

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.