| | |
| | | if (!string.IsNullOrEmpty(query) && query.StartsWith("?")) |
| | | { |
| | | rawData = query.Substring(1); |
| | | |
| | | } |
| | | } |
| | | else |
| | | { |
| | | |
| | | var originalContentType = actionContext.Request.Content.Headers.ContentType; |
| | | |
| | | |
| | | var bodyBytes = await actionContext.Request.Content.ReadAsByteArrayAsync(); |
| | | rawData = Encoding.UTF8.GetString(bodyBytes); |
| | | |
| | | |
| | | actionContext.Request.Content = new ByteArrayContent(bodyBytes); |
| | | if (actionContext.Request.Content.Headers.ContentType != null) |
| | | if (originalContentType != null) |
| | | { |
| | | actionContext.Request.Content.Headers.ContentType = |
| | | new System.Net.Http.Headers.MediaTypeHeaderValue( |
| | | actionContext.Request.Content.Headers.ContentType.MediaType); |
| | | actionContext.Request.Content.Headers.ContentType = originalContentType; |
| | | } |
| | | } |
| | | //else |
| | | //{ |
| | | // var bodyBytes = await actionContext.Request.Content.ReadAsByteArrayAsync(); |
| | | // rawData = Encoding.UTF8.GetString(bodyBytes); |
| | | |
| | | // actionContext.Request.Content = new ByteArrayContent(bodyBytes); |
| | | // if (actionContext.Request.Content.Headers.ContentType != null) |
| | | // { |
| | | // actionContext.Request.Content.Headers.ContentType = |
| | | // new System.Net.Http.Headers.MediaTypeHeaderValue( |
| | | // actionContext.Request.Content.Headers.ContentType.MediaType); |
| | | // } |
| | | //} |
| | | rawData = rawData.Replace("'", "%27"); |
| | | var signStr = rawData + "×tamp=" + timestamp + "&nonce=" + nonce + "&key=" + SecretKey; |
| | | var serverSign = ComputeHmacSha256(signStr, SecretKey); |
| | | |