RequestHelper
Class of network request helper,requests made through methods in this class automatically add signature information to the Http Header.
Structure function
RequestHelper
| Parameter | Type | Remarks |
|---|---|---|
| appKey | string | App in authentication information issued by authorized party |
| securityKey | string | Security in authentication information issued by authorized party |
| domain | string | Domain of network request, starting with http or https |
Method
- PostAsync
This method provides the capability to send post requests asynchronously.
Parameters:
| Parameter | Type | Remarks |
|---|---|---|
| url | string | The specific path of the network request, exclusive of the domain part. |
| postData | Dictionary<string, object> |
Request parameters |
| sign | string | Signature value of this request |
| nonce | string | Nonce of this request |
| timestamp | string | Time stamp of this request |
Return:
Task<string>
Possible exceptions:
| Exception information | Exception cause | Exception type |
|---|---|---|
| Signature verification failure | Unauthorized | HttpRequestException |
| Request target internal error | InternalServerError | HttpRequestException |
| Request path not found | NotFound | HttpRequestException |
| Request failure | Other | HttpRequestException |
- PostAsync
This method provides the capability to send post requests asynchronously.
This method is an overload of the previous method. Except for different parameters, other behaviors are consistent.
Parameter:
| Parameter | Type | Remarks |
|---|---|---|
| url | string | The specific path of the network request, exclusive of the domain part. |
| postData | Dictionary<string, object> |
Request parameters |