title: Modify Request.Content in WebApi DelegatingHandler
body: <p>I need to modify requested content to replace some characters (because of some unicode problems). Previously (in ASP.NET MVC), I did this with <strong>HttpModules</strong>; but in <strong>WebApi</strong>, it seems that I should <strong>DelegatingHandler</strong> but it is totally different.</p>
  <p>How can I modify <code>request.Content</code> inside the SendAsync method? I need something like this:</p>
  <pre class="lang-cs prettyprint-override"><code>protected async override Task&lt;HttpResponseMessage&gt; SendAsync(
          HttpRequestMessage request, CancellationToken cancellationToken)
      {
          var s = await request.Content.ReadAsStringAsync();
      // do some modification on &quot;s&quot;
      s= s.replace(&quot;x&quot;,&quot;y&quot;);
  
      request.Content = new StringContent(s);
  
      var response = await base.SendAsync(request, cancellationToken);
      
      return response;
  }
  </code></pre>
  <p>In the code above, I think I should check the request's content <strong>type</strong> and then decide what to do. If yes, which checks should I do?</p>