complete
Class: matlab.net.http.ResponseMessage
Namespace: matlab.net.http
Process or reprocess response payload Content-Type
Description
returns a copy of the message with msg
= complete(msg
,consumer
)msg.Body.Payload
processed
by a matlab.net.http.io.ContentConsumer
. The consumer might store its result in
msg.Body.Data
or process it in some other manner.
Use the complete
method when:
Body.Data
was unset or not set properly because the server inserted the wrong Content-Type in the message or the Content-Type was missing.You set the ConvertResponse
HTTPOptions.ConvertResponse
property tofalse
to prevent conversion of the data when it was originally received.You specified the wrong
consumer
when sending the message.
If there was an exception processing the received message, or if you set the
HTTPOptions.SavePayload
property when you sent the request,
the Body.Payload
in this response message contains the original
payload (if any). In this case, modify the header of this message to add or correct
the Content-Type field. Then call the complete
method to process
the response as if the server had inserted that Content-Type field originally. The
result is new contents in Body.Data
and/or
Data
processed by the specified
consumer
.
If Body.Payload
is set, then this method ignores the current value of
Body.Data
and reprocesses that payload based on
Content-Type. This case occurs for a conversion error or if you specified
SavePayload
. But if conversion of the incoming data
succeeded originally, but was incorrect, Body.Data
is set and
Body.Payload
might be empty. In this case, change the
ContentTypeField in the received message to the desired type and then call this
method. complete
attempts to convert the data back to a payload
based on the Body.ContentType
property used to convert it
originally. Then it is reconverted using the new Content-Type header in the response
message. If Data
is not empty, then the returned
Body.Payload
is set.
If you specified SavePayload
when sending
the message, complete
uses the original payload that
was preserved in Body.Payload
instead, with no
loss of information.
If the ResponseMessage.Completed
property is set,
complete
does nothing. In a message that contains a
Body
, this property is normally set only if
msg
.Body.Payload
has been set.
Input Arguments
Output Arguments
Examples
Version History
Introduced in R2016b