Main Content

matlab.net.http.field.SetCookieField class

Package:matlab.net.http.field
Superclasses:matlab.net.http.HeaderField

HTTP Set-Cookie header field

Description

ASetCookieFieldobject appears in a response message created by the server. A message can have one or more Set-Cookie fields. To extract theValueproperty as aCookieInfoobject, call theconvertmethod.

Class Attributes

Sealed
true

For information on class attributes, seeClass Attributes.

Properties

expand all

Header field name, specified as'Set-Cookie'.

Attributes:

GetAccess
public
SetAccess
public

Header field value, specified as a string.

Attributes:

GetAccess
public
SetAccess
public
Dependent
true

Methods

expand all

Examples

collapse all

r = matlab.net.http.RequestMessage(); uri = matlab.net.URI('http://httpbin.org/cookies/set?xxx=zzz&abc=def'); opts = matlab.net.http.HTTPOptions('MaxRedirects',0); resp = r.send(uri,opts); setCookieFields = resp.getFields('Set-Cookie');if~isempty(setCookieFields) cookieInfos = setCookieFields.convert(uri); r = r.addFields(matlab.net.http.field.CookieField([cookieInfos.Cookie]));endresp = r.send('http://httpbin.org/cookies'); disp(resp.Body.Data.cookies)
abc: 'def' xxx: 'zzz'

Version History

Introduced in R2016b