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 was archived by the owner on Oct 1, 2019. It is now read-only.
Arthur Heidt edited this page Nov 24, 2018
·
3 revisions
HttpReqSharp Examples
This page contains a few examples on how to use HttpReqSharp
GET Request Example
In this example a GET request is made to https://postman-echo.com/get, with one parameter foo, whose value is bar.
Thus, the URL for this request would be https://postman-echo.com/get?foo=bar.
publicstaticvoidMain(string[]args){varbaseUrl="https://postman-echo.com/get";varparameterName="foo";varparameterValue="bar";// Create request handlervarhandler=newHttpRequestHandler();// Wrap parameter in a parameter objectvarparam=newHttpRequestParameter(parameterName,parameterValue);// Put the parameters in a list. But you can use anything that implements the IEnumerable interface.varparameters=newList<IHttpRequestParameter>(){param};// Asynchronously make the request.varresultTask=handler.SendHttpRequestAsync(baseUrl,parameters,null,HttpRequestType.GET);// Do something with the resultsresultTask.ContinueWith(task =>{Console.WriteLine(task.Result.ResponseBody);});Console.ReadLine();}