Coder Social home page Coder Social logo

speakeasy's Introduction

speakeasy's People

Contributors

bitdeli-chef avatar charlieridley avatar dependabot-preview[bot] avatar hhansell avatar jonnii avatar robertcoltheart avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

speakeasy's Issues

Portable Library

  • custom user agents support
  • no longer need to specify content length?
  • no longer able to specify allow auto redirect?
  • update package
  • remove all remaining #ifdefs

Can we add support for writing dictionaries as query string parameters

Hi @jonnii , it would be good to support dictionary like query string parameters, something like this:

var fields = new Dictionary<object, object>()
{
  { "foo": "foo-values" },
  { "bar": "bar-values" }
}

httpClient.Get("authors", new { fields })
// -> translates to "GET ...authors?fields[foo]=foo-values&fields[bar]=bar-values"

The ApiController accepts such query string parameters natively ([FromQuery] Dictionary<string, string> fields), it would be great if speakeasy would support creating the parameters from a dictionary also

API for async callbacks

            return httpClient.PostAsync(new { arguments }, "admin/tasks/:taskName", new { taskName })
                .On(HttpStatusCode.NotAcceptable, handler => throw new InvalidOperationException(handler.AsString()))
                .On(HttpStatusCode.BadRequest, handler => throw new InvalidOperationException(handler.AsString()))
                .OnOk()
                .AsWrapped<T>();

Deserializing dates fail

Steps to reproduce:

  1. Add a DateTime property to the Product class in the Integration Test project and set a value:
public DateTime CreatedAt { get; set; }
public Product()
{
    CreatedAt = DateTime.Now;
}

Tests that try to deserialize this will fail

Ability to have multiple response handlers

    private Header Update(Model model)
    {
        var response = Client.Put(model, "models/:id", new { model.Id });

        response.On(HttpStatusCode.NotFound, () => { throw new Exception("Not found"); });
        response.On(HttpStatusCode.BadRequest, (List<ValidationError> errors) =>
        {
            throw new ValidationException(errors);
        });

        return response.On(HttpStatusCode.OK).As<Header>();
    }

When using On(Code, Action) don't throw exceptions if the status code does not match the expected status code.

WindowsAuthenticator will no longer work in certain scenarios under .Net 5.0

Under the covers, HttpClient uses a new protocol, and in our testing, using Windows authentication will usually result in an Unauthorized error. See https://docs.microsoft.com/en-US/dotnet/core/run-time-config/networking

In .Net 3.x, you could work around this by forcing HttpClient to use the old stack, using:

AppContext.SetSwitch("System.Net.Http.UseSocketsHttpHandler", false);

However in .Net 5.0 this setting is no longer available. Instead, you'd need to use the https://www.nuget.org/packages/System.Net.Http.WinHttpHandler package and use that handler. Trouble is, this is a Windows-only thing, and adding this as a dependency in SpeakEasy will make it non-cross platform.

I thought of adding a DefaultClientHandler property to HttpClientSettings. Trouble is that all the IAuthenticator implementations use HttpClientSettings in their signatures, and we'd have change it to be HttpMessageHandler, which is a significant breaking change. Furthermore, the WindowsAuthenticator wouldn't work with that implementation either, given that the handler can either be a HttpClientHandler or a WinHttpHandler, both of which use different properties to set the credentials.

Conundrum.

Add default handlers

It should be possible to register a default handler, for example BadRequest which can unwrap and throw an exception.

Road to 1.0 (part 2)

  • Multipart mime content (content refactor)
  • HttpClientHandler vs. HttpClient lifecycle
  • HttpResponseState organization
  • Make things internal where possible
  • Do a pass for dead code
  • All specs uncommented
  • need a default text formatter
  • #50 API for async calls
  • Kill Header Abstraction?
  • Make sure all streams are disposed of properly

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.