essencebit / SignalRSwaggerGen

MIT License
70 stars 8 forks source link

Whitespaces after method name and before query parameters #23

Closed imabusyman closed 2 years ago

imabusyman commented 2 years ago

https://localhost:44392/hubs/StronglyTypedTestHub/TestMethod ?agr1=1&arg2=1&date=2022-05-05T12%3A26%3A33.378Z&temperatureC=0&summary=string

This is causing error

404Undocumented | Error: response status is 404Response headers date: Thu,05 May 2022 12:32:03 GMT request-context: appId=cid-v1:fa498c63-faea-4730-9f8f-9b6a12fb489a server: Microsoft-IIS/10.0 x-powered-by: ASP.NET -- | --
imabusyman commented 2 years ago

This happens on code

    private string GetMethodPath(string hubPath, MethodInfo method, SignalRHubAttribute hubAttribute, SignalRMethodAttribute methodAttribute)
    {
        var methodPathSuffix = new string(' ', method.GetParameters().Length)**; <----HERE**
        var methodName = methodAttribute == null
            ? method.Name
            : methodAttribute.Name.Replace(Constants.MethodNamePlaceholder, method.Name);
        var nameTransformer = hubAttribute.NameTransformer ?? _options.NameTransformer;
        if (nameTransformer != null) methodName = nameTransformer.Transform(methodName);
        return $"{hubPath}/{methodName}{methodPathSuffix}";
    }
Dorin-Mocan commented 2 years ago

@imabusyman , yes, but this is done for supporting overloading server-side hub methods. The question is what you trying to do that you're getting the error? If you're trying to send a request from Swagger to the hub, then with regret I must say that Swagger does not support websockets. So you can only visualize the hubs in Swagger, but you can't interact with 'em. Sorry. In case you somehow have access to the url formed by SignalRSwaggerGen and you intend to use it, just trim the trailing spaces and you're good.

Dorin-Mocan commented 2 years ago

@imabusyman , please close the issue if it is not relevant to you anymore. Thanks!