djmnz / restfluencing Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
New to the .Net stack I was looking for something similar than Mocha/Chai in the NodeJS world to be able to test my API. This package seams to look pretty promising but I cannot reproduce the init exemple present in the README. So I added a class in my XUnit test project like so
using RestFluencing;
using Xunit.Sdk;
namespace HelloAssoApi.UnitTest.TestApiControllers
{
[TestClass]
public class OrganizationsControllerTest
{
protected RestConfiguration _configuration = null;
[ClassInitialize]
public void SetupCommonConfiguration()
{
_configuration = RestConfiguration.JsonDefault();
_configuration.WithHeader("User-Agent", "RestFluencing Sample");
_configuration.WithBaseUrl("https://api.github.com/");
}
}
}
But I don't have [ClassInitialize]
available.
Like I saied it's maybe a noob question but I cannot find a way to init the project properly.
AFAIK, there isn't a wait to use WithBody(string)
with a data type other than string. I'm trying to send an un-serialized MultipartFormDataContent object. Currently, is this possible to do with RestFluencing in general? If not, is this feature going to be implemented?
Hi - love the library.
We want to use the ID from one request to construct a second request. How can we access the response model from the first outside of an "assert" expression?
Thanks, Adam
RestFluencing doesn't seem to work with .NET Core Integration Tests. It appears that all HTTP requests go over the network rather than direct to the in-memory test server.
I see that a HttpClient is constructed directly in src/restfluencing.Core/Client/HttpClientWrapper/HttpClient.cs:
public IApiClientResponse ExecuteRequest(IApiClientRequest request)
{
using (HttpClient client = new HttpClient())
{
I need to be able to pass in my own instance of HttpClient.
I found that sending PATCH requests using the RestFluencing library actually sends POST requests. Doing some investigating, I found this:
/// <summary>
/// Prepare a PATCH request to the URL. You must have set the property <see cref="RestConfiguration.BaseUrl"/> of the configuration
/// </summary>
public static RestRequest **Patch**(this RestConfiguration config, string relativeUrl)
{
if (config == null)
{
throw new ArgumentNullException(nameof(config), ErrorMessages.NoConfiguration);
}
if (config.BaseUrl == null)
{
throw new ArgumentException(ErrorMessages.BaseUrlIsNotSet, nameof(relativeUrl));
}
return Rest.**Post**(relativeUrl, config);
}
Was this a typo, or was this intentional and PATCH requests aren't currently supported?
Does this framework support sending GET requests with a body? I have tested it like so, without any success:
Rest.Get("MyUrl/")
.WithJsonBody(new { type = "SpecialType" })
.Response()
.Assert();
Hi,
Firstly, thanks for all the work in your framework.
A few minor issues I've noted to improve your service:
Thanks again!
Hi,
Is there a plan to make this framework .NET standard/core compatible?
Regards
Investigate logging requests and responses sent by RestFluencing.
We could also log the validation processes.
Does anyone has an opinion on this? Anyone else interested in this? Discussion initiated from #10
Bug was found on the BeforeRequest event where the RequestContext was not being populated correctly.
Bug discovered when working on the Multipart custom client
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.