chromelyapps / Chromely

Build Cross Platform HTML Desktop Apps on .NET using native GUI, HTML5, JavaScript, CSS, Owin, AspNetCore (MVC, RazorPages, Blazor)
MIT License
2.99k stars 279 forks source link

Can't sync ChromelyResponse.RequestId with ChromelyRequest.Id #368

Closed xplicit closed 2 years ago

xplicit commented 2 years ago

These two lines of code passes parameters to controller and then creates response based on content which was returned from controller.

https://github.com/chromelyapps/Chromely/blob/master/src/Chromely.Core/Network/Routes/ControllerRoute.cs#L47-L49

But they don't allow to sync Response.RequestId with Request.Id.

In previous version of chromely controller method looked like this:

        public IChromelyResponse GetInstalled(IChromelyRequest request)
        {
            return new ChromelyResponse(request.Id)
            {
                Data = ...
            }

So we were able to set up RequestId in ChromelyResponse to the same value as Id of request.

But in new version of Chromely it's impossible to get request.Id from controller to sync request.Id with ChromelyResponse.RequestId. And Chromely itself does not sync these values.

mattkol commented 2 years ago

@xplicit the change is really to give more freedom to developers. Seems like you can manually set the Id before you return in the controller class.

But it can also be argued that we should make it backward compatible. So maybe needs to be added back - which also allows developers to override if they want. I will see about doing that.

Thanks.