Reputation: 38529
I'm working on a solution for authenticating WebApi requests with HMAc (Similar to this)
Part of this, looks at the outbound requests Content, and generates an MD5 hash of it (this is included as part of the overall hash of the message)
In one particular instance (a GET request), on my outbound requests, the value of .Content is null.
However, when it reaches the server side handler, there is a value in .Content
If I do a .ReadAsStringAsync() on the request.Content coming in to the handler, I can see it now looks like this:
Id = 1, Status = RanToCompletion, Method = "{null}", Result = ""
AsyncState: null
CancellationPending: false
CreationOptions: None
Exception: null
Id: 1
Result: ""
Status: RanToCompletion
Which, when generating an MD5 hash of the content, obviously isn't matching with my outbound request.
Any idea where the "content" has come from?
Can I prevent it from generating this?
EDIT This only seems to happen on GET requests
Upvotes: 0
Views: 432
Reputation: 2367
That looks to me like the output of Task.ToString(). You need to be looking at the result of the task. Either await it or access .Result.
Upvotes: 3