Object -
grpc
:
Headers
Provides the actions to read/write header values in a gRPC request/response message.
Methods
Checks whether the requested header exists.
boolean result = headers.exists("content-type");
Returns the header value with the specified header name. If there are more than one header values for the
specified header name, the first value is returned.
string? result = headers.get("content-type");
Gets all the transport headers with the specified header name.
string[] result = headers.getAll("content-type");
Sets the value of a transport header.
headers.setEntry("content-type", "application/grpc")
Adds the specified key/value pair as an HTTP header to the request.
headers.addEntry("content-type", "application/grpc")
Removes a transport header from the request.
headers.remove("content-type")
Removes all the transport headers from the message.
headers.removeAll()
Checks whether the requested header exists.
boolean result = headers.exists("content-type");
Parameters
- headerName string
-
The header name
-
Return Type
(boolean) True if header exists or else false
Returns the header value with the specified header name. If there are more than one header values for the
specified header name, the first value is returned.
string? result = headers.get("content-type");
Parameters
- headerName string
-
The header name
-
Return Type
(string?) First header value if exists or else
()
Gets all the transport headers with the specified header name.
string[] result = headers.getAll("content-type");
Parameters
- headerName string
-
The header name
-
Return Type
(string[]) Header value array
Sets the value of a transport header.
headers.setEntry("content-type", "application/grpc")
Parameters
- headerName string
-
The header name
- headerValue string
-
The header value
Adds the specified key/value pair as an HTTP header to the request.
headers.addEntry("content-type", "application/grpc")
Parameters
- headerName string
-
The header name
- headerValue string
-
The header value
Removes a transport header from the request.
headers.remove("content-type")
Parameters
- headerName string
-
The header name