.. _object_HttpResponse: :index:`HttpResponse` --------------------- Description *********** The HttpResponse object represents a HTTP response received from a HTTP server. It usually is associated with the corresponding :ref:`HttpRequest ` object in the :ref:`HttpRequest.response ` property. After a :ref:`HttpResponse ` has been received, it's :ref:`statusCode ` should be checked to ensure the desired result. If succesful the :ref:`content ` property holds the received data. :**› Inherits**: :ref:`Object ` Overview ******** Properties ++++++++++ .. hlist:: :columns: 2 * :ref:`autoDetectDataTypeFromContentType ` * :ref:`connectionEncrypted ` * :ref:`content ` * :ref:`headers ` * :ref:`originalContentLength ` * :ref:`pipeliningWasUsed ` * :ref:`reasonPhrase ` * :ref:`redirectionTarget ` * :ref:`statusCode ` * :ref:`Object.objectId ` * :ref:`Object.parent ` Methods +++++++ .. hlist:: :columns: 1 * :ref:`wait() ` * :ref:`Object.deserializeProperties() ` * :ref:`Object.fromJson() ` * :ref:`Object.serializeProperties() ` * :ref:`Object.toJson() ` Signals +++++++ .. hlist:: :columns: 1 * :ref:`headersDataChanged() ` * :ref:`received() ` * :ref:`Object.completed() ` Enumerations ++++++++++++ .. hlist:: :columns: 1 * :ref:`StatusCode ` Properties ********** .. _property_HttpResponse_autoDetectDataTypeFromContentType: .. _signal_HttpResponse_autoDetectDataTypeFromContentTypeChanged: .. index:: single: autoDetectDataTypeFromContentType autoDetectDataTypeFromContentType +++++++++++++++++++++++++++++++++ This property holds whether to automatically detect the data type from the received content type header if any. If disabled, the received data is treated as if it had the configured type. :**› Type**: Boolean :**› Default**: ``true`` :**› Signal**: autoDetectDataTypeFromContentTypeChanged() :**› Attributes**: Writable .. _property_HttpResponse_connectionEncrypted: .. _signal_HttpResponse_connectionEncryptedChanged: .. index:: single: connectionEncrypted connectionEncrypted +++++++++++++++++++ This property holds Indicates whether the data was obtained through an encrypted (secure) connection. :**› Type**: Boolean :**› Signal**: connectionEncryptedChanged() :**› Attributes**: Readonly .. _property_HttpResponse_content: .. _signal_HttpResponse_contentChanged: .. index:: single: content content +++++++ This property holds the content received from the server. :**› Type**: :ref:`HttpContent ` :**› Signal**: contentChanged() :**› Attributes**: Writable .. _property_HttpResponse_headers: .. _signal_HttpResponse_headersChanged: .. index:: single: headers headers +++++++ This property holds a list of header objects representing the HTTP headers received from the server. :**› Type**: :ref:`List `\<:ref:`HttpHeader `> :**› Signal**: headersChanged() :**› Attributes**: Readonly .. _property_HttpResponse_originalContentLength: .. _signal_HttpResponse_originalContentLengthChanged: .. index:: single: originalContentLength originalContentLength +++++++++++++++++++++ This property holds the original content-length attribute before being invalidated and removed from the header when the data is compressed and the request was marked to be decompressed automatically. :**› Type**: SignedBigInteger :**› Signal**: originalContentLengthChanged() :**› Attributes**: Readonly .. _property_HttpResponse_pipeliningWasUsed: .. _signal_HttpResponse_pipeliningWasUsedChanged: .. index:: single: pipeliningWasUsed pipeliningWasUsed +++++++++++++++++ This property holds whether the HTTP pipelining was used for receiving this response. :**› Type**: Boolean :**› Signal**: pipeliningWasUsedChanged() :**› Attributes**: Readonly .. _property_HttpResponse_reasonPhrase: .. _signal_HttpResponse_reasonPhraseChanged: .. index:: single: reasonPhrase reasonPhrase ++++++++++++ This property holds the HTTP reason phrase as received from the HTTP server (like "Ok", "Found", "Not Found", "Access Denied", etc.) This is the human-readable representation of the status code (see :ref:`statusCode `). :**› Type**: String :**› Signal**: reasonPhraseChanged() :**› Attributes**: Readonly .. _property_HttpResponse_redirectionTarget: .. _signal_HttpResponse_redirectionTargetChanged: .. index:: single: redirectionTarget redirectionTarget +++++++++++++++++ This property holds that the server is redirecting the request to a different URL. The API does not by default follow redirections: the application can determine if the requested redirection should be allowed, according to its security policies, or it can set :ref:`HttpRequest.followRedirects ` to ``true`` (in which case the redirection will be followed and this attribute will be empty in the response). The returned URL might be relative. :**› Type**: String :**› Signal**: redirectionTargetChanged() :**› Attributes**: Readonly .. _property_HttpResponse_statusCode: .. _signal_HttpResponse_statusCodeChanged: .. index:: single: statusCode statusCode ++++++++++ This property holds the HTTP status code received from the HTTP server such as 200, 404 etc. See the :ref:`StatusCode ` enumeration for details. :**› Type**: :ref:`StatusCode ` :**› Signal**: statusCodeChanged() :**› Attributes**: Readonly Methods ******* .. _method_HttpResponse_wait: .. index:: single: wait wait(SignedInteger msecs) +++++++++++++++++++++++++ This method blocks until the HTTP response has been received. This method will timeout after `msecs` milliseconds. In most cases the asynchronuous :ref:`received() ` signal should be used instead of this synchronuous method. :**› Returns**: Boolean Signals ******* .. _signal_HttpResponse_headersDataChanged: .. index:: single: headersDataChanged headersDataChanged(SignedInteger index) +++++++++++++++++++++++++++++++++++++++ This signal is emitted whenever the :ref:`List.dataChanged() ` signal is emitted, i.e. the item at ``index`` in the :ref:`headers ` list itself emitted the dataChanged() signal. .. _signal_HttpResponse_received: .. index:: single: received received() ++++++++++ This signal is emitted when a response is received for the corresponding request and all properties have been updated with the received data. Enumerations ************ .. _enum_HttpResponse_StatusCode: .. index:: single: StatusCode StatusCode ++++++++++ This enumeration describes all available Hypertext Transfer Protocol (HTTP) response status codes. Status codes are issued by a server in response to a client's request made to the server. .. index:: single: HttpResponse.InvalidStatus .. index:: single: HttpResponse.Continue .. index:: single: HttpResponse.SwitchingProtocols .. index:: single: HttpResponse.Processing .. index:: single: HttpResponse.OK .. index:: single: HttpResponse.Created .. index:: single: HttpResponse.Accepted .. index:: single: HttpResponse.NonAuthoritativeInformation .. index:: single: HttpResponse.NoContent .. index:: single: HttpResponse.ResetContent .. index:: single: HttpResponse.PartialContent .. index:: single: HttpResponse.MultiStatus .. index:: single: HttpResponse.AlreadyReported .. index:: single: HttpResponse.IMUsed .. index:: single: HttpResponse.MultipleChoices .. index:: single: HttpResponse.MovedPermanently .. index:: single: HttpResponse.Found .. index:: single: HttpResponse.SeeOther .. index:: single: HttpResponse.NotModified .. index:: single: HttpResponse.UseProxy .. index:: single: HttpResponse.TemporaryRedirect .. index:: single: HttpResponse.PermanentRedirect .. index:: single: HttpResponse.BadRequest .. index:: single: HttpResponse.Unauthorized .. index:: single: HttpResponse.PaymentRequired .. index:: single: HttpResponse.Forbidden .. index:: single: HttpResponse.NotFound .. index:: single: HttpResponse.MethodNotAllowed .. index:: single: HttpResponse.NotAcceptable .. index:: single: HttpResponse.ProxyAuthenticationRequired .. index:: single: HttpResponse.RequestTimeout .. index:: single: HttpResponse.Conflict .. index:: single: HttpResponse.Gone .. index:: single: HttpResponse.LengthRequired .. index:: single: HttpResponse.PreconditionFailed .. index:: single: HttpResponse.RequestEntityTooLarge .. index:: single: HttpResponse.URITooLong .. index:: single: HttpResponse.UnsupportedMediaType .. index:: single: HttpResponse.RequestedRangeNotSatisfiable .. index:: single: HttpResponse.ExpectationFailed .. index:: single: HttpResponse.PolicyNotFulfilled .. index:: single: HttpResponse.MisdirectedRequest .. index:: single: HttpResponse.UnprocessableEntity .. index:: single: HttpResponse.Locked .. index:: single: HttpResponse.FailedDependency .. index:: single: HttpResponse.UpgradeRequired .. index:: single: HttpResponse.PreconditionRequired .. index:: single: HttpResponse.TooManyRequests .. index:: single: HttpResponse.RequestHeaderFieldsTooLarge .. index:: single: HttpResponse.UnavailableForLegalReasons .. index:: single: HttpResponse.InternalServerError .. index:: single: HttpResponse.NotImplemented .. index:: single: HttpResponse.BadGateway .. index:: single: HttpResponse.ServiceUnavailable .. index:: single: HttpResponse.GatewayTimeout .. index:: single: HttpResponse.HttpVersionNotSupported .. index:: single: HttpResponse.VariantAlsoNegotiates .. index:: single: HttpResponse.InsufficientStorage .. index:: single: HttpResponse.LoopDetected .. index:: single: HttpResponse.NotExtended .. index:: single: HttpResponse.NetworkAuthenticationRequired .. list-table:: :widths: auto :header-rows: 1 * - Name - Value - Description .. _enumitem_HttpResponse_InvalidStatus: * - ``HttpResponse.InvalidStatus`` - ``-1`` - Invalid status code, only internal use. .. _enumitem_HttpResponse_Continue: * - ``HttpResponse.Continue`` - ``100`` - See `details on status code 100 `_ . .. _enumitem_HttpResponse_SwitchingProtocols: * - ``HttpResponse.SwitchingProtocols`` - ``101`` - See `details on status code 101 `_ . .. _enumitem_HttpResponse_Processing: * - ``HttpResponse.Processing`` - ``102`` - See `details on status code 102 `_ . .. _enumitem_HttpResponse_OK: * - ``HttpResponse.OK`` - ``200`` - See `details on status code 200 `_ . .. _enumitem_HttpResponse_Created: * - ``HttpResponse.Created`` - ``201`` - See `details on status code 201 `_ . .. _enumitem_HttpResponse_Accepted: * - ``HttpResponse.Accepted`` - ``202`` - See `details on status code 202 `_ . .. _enumitem_HttpResponse_NonAuthoritativeInformation: * - ``HttpResponse.NonAuthoritativeInformation`` - ``203`` - See `details on status code 203 `_ . .. _enumitem_HttpResponse_NoContent: * - ``HttpResponse.NoContent`` - ``204`` - See `details on status code 204 `_ . .. _enumitem_HttpResponse_ResetContent: * - ``HttpResponse.ResetContent`` - ``205`` - See `details on status code 205 `_ . .. _enumitem_HttpResponse_PartialContent: * - ``HttpResponse.PartialContent`` - ``206`` - See `details on status code 206 `_ . .. _enumitem_HttpResponse_MultiStatus: * - ``HttpResponse.MultiStatus`` - ``207`` - See `details on status code 207 `_ . .. _enumitem_HttpResponse_AlreadyReported: * - ``HttpResponse.AlreadyReported`` - ``208`` - See `details on status code 208 `_ . .. _enumitem_HttpResponse_IMUsed: * - ``HttpResponse.IMUsed`` - ``226`` - See `details on status code 226 `_ . .. _enumitem_HttpResponse_MultipleChoices: * - ``HttpResponse.MultipleChoices`` - ``300`` - See `details on status code 300 `_ . .. _enumitem_HttpResponse_MovedPermanently: * - ``HttpResponse.MovedPermanently`` - ``301`` - See `details on status code 301 `_ . .. _enumitem_HttpResponse_Found: * - ``HttpResponse.Found`` - ``302`` - See `details on status code 302 `_ . .. _enumitem_HttpResponse_SeeOther: * - ``HttpResponse.SeeOther`` - ``303`` - See `details on status code 303 `_ . .. _enumitem_HttpResponse_NotModified: * - ``HttpResponse.NotModified`` - ``304`` - See `details on status code 304 `_ . .. _enumitem_HttpResponse_UseProxy: * - ``HttpResponse.UseProxy`` - ``305`` - See `details on status code 305 `_ . .. _enumitem_HttpResponse_TemporaryRedirect: * - ``HttpResponse.TemporaryRedirect`` - ``307`` - See `details on status code 307 `_ . .. _enumitem_HttpResponse_PermanentRedirect: * - ``HttpResponse.PermanentRedirect`` - ``308`` - See `details on status code 308 `_ . .. _enumitem_HttpResponse_BadRequest: * - ``HttpResponse.BadRequest`` - ``400`` - See `details on status code 400 `_ . .. _enumitem_HttpResponse_Unauthorized: * - ``HttpResponse.Unauthorized`` - ``401`` - See `details on status code 401 `_ . .. _enumitem_HttpResponse_PaymentRequired: * - ``HttpResponse.PaymentRequired`` - ``402`` - See `details on status code 402 `_ . .. _enumitem_HttpResponse_Forbidden: * - ``HttpResponse.Forbidden`` - ``403`` - See `details on status code 403 `_ . .. _enumitem_HttpResponse_NotFound: * - ``HttpResponse.NotFound`` - ``404`` - See `details on status code 404 `_ . .. _enumitem_HttpResponse_MethodNotAllowed: * - ``HttpResponse.MethodNotAllowed`` - ``405`` - See `details on status code 405 `_ . .. _enumitem_HttpResponse_NotAcceptable: * - ``HttpResponse.NotAcceptable`` - ``406`` - See `details on status code 406 `_ . .. _enumitem_HttpResponse_ProxyAuthenticationRequired: * - ``HttpResponse.ProxyAuthenticationRequired`` - ``407`` - See `details on status code 407 `_ . .. _enumitem_HttpResponse_RequestTimeout: * - ``HttpResponse.RequestTimeout`` - ``408`` - See `details on status code 408 `_ . .. _enumitem_HttpResponse_Conflict: * - ``HttpResponse.Conflict`` - ``409`` - See `details on status code 409 `_ . .. _enumitem_HttpResponse_Gone: * - ``HttpResponse.Gone`` - ``410`` - See `details on status code 410 `_ . .. _enumitem_HttpResponse_LengthRequired: * - ``HttpResponse.LengthRequired`` - ``411`` - See `details on status code 411 `_ . .. _enumitem_HttpResponse_PreconditionFailed: * - ``HttpResponse.PreconditionFailed`` - ``412`` - See `details on status code 412 `_ . .. _enumitem_HttpResponse_RequestEntityTooLarge: * - ``HttpResponse.RequestEntityTooLarge`` - ``413`` - See `details on status code 413 `_ . .. _enumitem_HttpResponse_URITooLong: * - ``HttpResponse.URITooLong`` - ``414`` - See `details on status code 414 `_ . .. _enumitem_HttpResponse_UnsupportedMediaType: * - ``HttpResponse.UnsupportedMediaType`` - ``415`` - See `details on status code 415 `_ . .. _enumitem_HttpResponse_RequestedRangeNotSatisfiable: * - ``HttpResponse.RequestedRangeNotSatisfiable`` - ``416`` - See `details on status code 416 `_ . .. _enumitem_HttpResponse_ExpectationFailed: * - ``HttpResponse.ExpectationFailed`` - ``417`` - See `details on status code 417 `_ . .. _enumitem_HttpResponse_PolicyNotFulfilled: * - ``HttpResponse.PolicyNotFulfilled`` - ``420`` - See `details on status code 420 `_ . .. _enumitem_HttpResponse_MisdirectedRequest: * - ``HttpResponse.MisdirectedRequest`` - ``421`` - See `details on status code 421 `_ . .. _enumitem_HttpResponse_UnprocessableEntity: * - ``HttpResponse.UnprocessableEntity`` - ``422`` - See `details on status code 422 `_ . .. _enumitem_HttpResponse_Locked: * - ``HttpResponse.Locked`` - ``423`` - See `details on status code 423 `_ . .. _enumitem_HttpResponse_FailedDependency: * - ``HttpResponse.FailedDependency`` - ``424`` - See `details on status code 424 `_ . .. _enumitem_HttpResponse_UpgradeRequired: * - ``HttpResponse.UpgradeRequired`` - ``426`` - See `details on status code 426 `_ . .. _enumitem_HttpResponse_PreconditionRequired: * - ``HttpResponse.PreconditionRequired`` - ``428`` - See `details on status code 428 `_ . .. _enumitem_HttpResponse_TooManyRequests: * - ``HttpResponse.TooManyRequests`` - ``429`` - See `details on status code 429 `_ . .. _enumitem_HttpResponse_RequestHeaderFieldsTooLarge: * - ``HttpResponse.RequestHeaderFieldsTooLarge`` - ``431`` - See `details on status code 431 `_ . .. _enumitem_HttpResponse_UnavailableForLegalReasons: * - ``HttpResponse.UnavailableForLegalReasons`` - ``451`` - See `details on status code 451 `_ . .. _enumitem_HttpResponse_InternalServerError: * - ``HttpResponse.InternalServerError`` - ``500`` - See `details on status code 500 `_ . .. _enumitem_HttpResponse_NotImplemented: * - ``HttpResponse.NotImplemented`` - ``501`` - See `details on status code 501 `_ . .. _enumitem_HttpResponse_BadGateway: * - ``HttpResponse.BadGateway`` - ``502`` - See `details on status code 502 `_ . .. _enumitem_HttpResponse_ServiceUnavailable: * - ``HttpResponse.ServiceUnavailable`` - ``503`` - See `details on status code 503 `_ . .. _enumitem_HttpResponse_GatewayTimeout: * - ``HttpResponse.GatewayTimeout`` - ``504`` - See `details on status code 504 `_ . .. _enumitem_HttpResponse_HttpVersionNotSupported: * - ``HttpResponse.HttpVersionNotSupported`` - ``505`` - See `details on status code 505 `_ . .. _enumitem_HttpResponse_VariantAlsoNegotiates: * - ``HttpResponse.VariantAlsoNegotiates`` - ``506`` - See `details on status code 506 `_ . .. _enumitem_HttpResponse_InsufficientStorage: * - ``HttpResponse.InsufficientStorage`` - ``507`` - See `details on status code 507 `_ . .. _enumitem_HttpResponse_LoopDetected: * - ``HttpResponse.LoopDetected`` - ``508`` - See `details on status code 508 `_ . .. _enumitem_HttpResponse_NotExtended: * - ``HttpResponse.NotExtended`` - ``510`` - See `details on status code 510 `_ . .. _enumitem_HttpResponse_NetworkAuthenticationRequired: * - ``HttpResponse.NetworkAuthenticationRequired`` - ``511`` - See `details on status code 511 `_ . Example ******* See :ref:`HttpRequest example ` on how to use HttpResponse.