Http Utils Example

Is there a better way to achieve this call:

var response = await url.PostToUrlAsync($"Body={body.UrlEncode()}&From={from.UrlEncode()}&To={to.UrlEncode()}", requestFilter: x=>x.AddBasicAuth(_accountSid, _token));

I tried something like url.PostToUrlAsync(new {Body=body,From=from,To=to}, requestFilter...) but it produces a different result.

I forgot about custom scopes and the api wants Pascal Case:

using (JsConfig.With(new Config() 
{
    TextCase = TextCase.PascalCase
}))
{
    response = await url.PostToUrlAsync(new { Body=body, From=from, To=to }, 
        requestFilter: x => x.AddBasicAuth(_accountSid, _token));
}
2 Likes