Skip to content

Commit

Permalink
fix(Request): Remove string parsing of status code to long
Browse files Browse the repository at this point in the history
The ToString method of the .NET error code results in the actual string explanation of the error
code. When trying to parse this to a long we end up with error code 0. Cast the code as a long
instead.
  • Loading branch information
mediumTaj committed Apr 26, 2019
1 parent 6902828 commit 4ce5bbc
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/IBM.Cloud.SDK.Core/Http/Request.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,7 @@ public async Task<DetailedResponse<T>> As<T>()
detailedResponse.Headers.Add(header.Key, string.Join(",", header.Value));

// Set staus code
long.TryParse(message.StatusCode.ToString(), out long statusCode);
detailedResponse.StatusCode = statusCode;
detailedResponse.StatusCode = (long)message.StatusCode;

// Set response
detailedResponse.Response = JValue.Parse(result).ToString(Formatting.Indented);
Expand Down

0 comments on commit 4ce5bbc

Please sign in to comment.