authorizationData method
Sends the POST request to the authorizationEndpoint.
Applies the headers as following:
...
headers: {
...headers,
'content-type': 'application/x-www-form-urlencoded'
},
...
Applies the body
as following:
body: {
'socket_id': socketId,
'channel_name': channelName,
},
Implementation
@override
Future<T> authorizationData(String socketId, String channelName) async {
final response = await http.post(
authorizationEndpoint,
headers: {
...headers,
if (overrideContentTypeHeader)
'content-type': 'application/x-www-form-urlencoded',
},
body: {
'socket_id': socketId,
'channel_name': channelName,
},
);
if (response.statusCode != 200) {
throw EndpointAuthorizableChannelTokenAuthorizationException._(
response: response,
authorizationEndpoint: authorizationEndpoint,
);
}
return parser(response);
}