You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.
I want to implement ThrottlingHandler.SetIdentity so that it fetches the ClientId from a application/x-www-form-urlencoded POST like:
POST /WebAPI.DemoThrottle/Values/Throttle HTTP/1.1
Host: localhost:63621
Content-Type: application/x-www-form-urlencoded
ClientId=MyClientId&OtherParam=123
I came up with the following:
protected override RequestIdentity SetIdentity(HttpRequestMessage request) { var form = request.Content.ReadAsFormDataAsync().Result; var clientId = form["ClientId"];
But this seems to remove the body from the Action in the controller:
public async Task<IHttpActionResult> Throttle([FromBody] ThrottleData throttle)
and throttle will be null.
Any suggestions or am I doing this the wrong way?
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I want to implement ThrottlingHandler.SetIdentity so that it fetches the ClientId from a application/x-www-form-urlencoded POST like:
POST /WebAPI.DemoThrottle/Values/Throttle HTTP/1.1
Host: localhost:63621
Content-Type: application/x-www-form-urlencoded
ClientId=MyClientId&OtherParam=123
I came up with the following:
protected override RequestIdentity SetIdentity(HttpRequestMessage request) { var form = request.Content.ReadAsFormDataAsync().Result; var clientId = form["ClientId"];
But this seems to remove the body from the Action in the controller:
public async Task<IHttpActionResult> Throttle([FromBody] ThrottleData throttle)
and throttle will be null.
Any suggestions or am I doing this the wrong way?
The text was updated successfully, but these errors were encountered: