%% Verify Required Field Added to Request Message
% Add a missing Date header field to a request message using the  RequestMessage.complete method.
% Create a request message to get text from the MathWorks website.

uri = matlab.net.URI('https://www.mathworks.com');
req = matlab.net.http.RequestMessage;

%
% Verify the message contains a Date field. The date value reflects your system information. The value indices{1} = [] indicates that req does not contain a Date field.

request = complete(req,uri);
[fields,indices] = getFields([req,request],?matlab.net.http.field.HTTPDateField)

% Copyright 2012 The MathWorks, Inc.