Git Product home page Git Product logo

restfluencing's People

Contributors

adarmus avatar djmnz avatar natn2323 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

restfluencing's Issues

Init project from README exemple

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.

Using WithBody function with MultipartFormDataContent object

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?

Incompatible with .NET Core integration tests

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.

PATCH request acts as POST request

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?

Passing content in GET request

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();

Missing headers and http methods

Hi,

Firstly, thanks for all the work in your framework.

A few minor issues I've noted to improve your service:

  • There are some missing HTTP methods, like Patch/Options
  • There is no way to specify UseDefaultCredentials (AFAIK)
  • Some headers in the response cannot be validated. Example is Allow header from OPTIONS verb. This can easily be fixed in your IApiClient implementation by looking for headers in response.Context.Headers.
  • Might also be nice to (optionally?) log out the requests as they are being executed

Thanks again!

Log requests and responses

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.