matlab.net.http.ProtocolVersion - HTTP protocol version - MATLAB (original) (raw)
Main Content
Namespace: matlab.net.http
Description
If you use 'HTTP/1.1'
, you do not need to create a protocol version. To use a different protocol, use the ProtocolVersion
class to create the protocol version and add it to the request line of a request message.
The server returns a ProtocolVersion
object in the status line of a response message.
Creation
Description
obj = matlab.net.http.ProtocolVersion(name,major,minor)
creates the protocol version with the specified properties. This constructor enforces proper syntax of the parameters. For test purposes, create aProtocolVersion
object in a request message. Then use theisequal
method to compare this value with the value returned by the server in the response message.
obj = matlab.net.http.ProtocolVersion([str](#mw%5F8abbd250-2bd7-4c3b-ab6a-b9865dc83c2c))
creates the version from str
.
Input Arguments
Protocol version, specified as a string or a character vector acceptable to theProtocolVersion
constructor. str
should have the syntax of name plus major and minor version numbers, but no error occurs if it does not.
Properties
Protocol name, specified as a string or character vector.
Example: 'HTTP'
Attributes:
GetAccess | public |
---|---|
SetAccess | public |
Dependent | true |
Major version number, specified as an integer value from 0 through 9.
Example: 1
Attributes:
GetAccess | public |
---|---|
SetAccess | public |
Dependent | true |
Minor version number, specified as an integer value from 0 through 9.
Example: 1
Attributes:
GetAccess | public |
---|---|
SetAccess | public |
Dependent | true |
Methods
These methods specialize standard MATLABĀ® operators and functions for objects in this class.
eq, isequal | true if protocol versions are functionally equivalent. The comparison ignores the case of the Name property and uses numeric comparisons for the Major andMinor properties. |
---|---|
string | Protocol version as string |
char | Protocol version as character vector |
Examples
Send an HTTP request message to mathworks.com
using default values. Display the protocol version in the response message.
request = matlab.net.http.RequestMessage; uri = matlab.net.URI('https://www.mathworks.com'); response = send(request,uri); version = string(response.StatusLine.ProtocolVersion)
Version History
Introduced in R2016b