isequal

Class: matlab.net.http.HeaderField
Package: matlab.net.http

Compare two HeaderField arrays

Syntax

  • tf = isequal(field1,field2)
    example

Description

example

tf = isequal(field1,field2) returns logical 1 (true) if header field array field1 is equal to header field array field2. Otherwise, it returns logical 0 (false). The arrays must be the same size and corresponding elements must be equal according to the HeaderField.eq method.

Input Arguments

expand all

Header field, specified as a matlab.net.http.HeaderField object or a vector of HeaderField objects.

Header field, specified as a matlab.net.http.HeaderField object or a vector of HeaderField objects.

Examples

expand all

Create a Content-Type field in a request message.

uri = matlab.net.URI('http://www.mathworks.com');
req = matlab.net.http.RequestMessage;
req = addFields(req,matlab.net.http.HeaderField('Content-Type','text/html;charset=utf-8'));
resp = send(req,uri);

Search for a Content-Type field in each message.

f1 = getFields(req,'Content-Type');
f2 = getFields(resp,'Content-Type');

Compare the fields.

isequal(f1,f2)
ans =      1

The messages contain the same Content-Type header fields.

Introduced in R2016b

Was this topic helpful?