Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PostAsync has a signature conflict #74

Closed
SimonDarksideJ opened this issue May 4, 2024 · 1 comment · Fixed by #75
Closed

PostAsync has a signature conflict #74

SimonDarksideJ opened this issue May 4, 2024 · 1 comment · Fixed by #75
Labels
documentation Improvements or additions to documentation

Comments

@SimonDarksideJ
Copy link
Collaborator

SimonDarksideJ commented May 4, 2024

Overview

From the example given in the ReadMe, this highlights a signature conflict for the PostAsync call between:

        public static async Task<Response> PostAsync(
            string query,
            string jsonData,
            Action<string> serverSentEventCallback,
            RestParameters parameters = null,
            CancellationToken cancellationToken = default)

And

        public static async Task<Response> PostAsync(
            string query,
            string jsonData,
            Action<Response> dataReceivedEventCallback,
            int? eventChunkSize = null,
            RestParameters parameters = null,
            CancellationToken cancellationToken = default)

Likely due to the defaults applied to the second method.

To Reproduce

Steps to reproduce the behavior:

  1. Create a new script
  2. Copy the Rest example from the readme
      var jsonData = "{\"data\":\"content\"}";
      var response = await Rest.PostAsync("www.your.api/endpoint", jsonData, eventData =>
      {
          Debug.Log(eventData);
      });
  1. Observe conflict error

image

Expected behavior

Examples should work out of the box, as should all method overloads.

@SimonDarksideJ SimonDarksideJ added the bug Something isn't working label May 4, 2024
@StephenHodgson StephenHodgson added documentation Improvements or additions to documentation and removed bug Something isn't working labels May 4, 2024
@StephenHodgson
Copy link
Member

wouldn't just adding the name of the parameter fix this?

      var jsonData = "{\"data\":\"content\"}";
      var response = await Rest.PostAsync("www.your.api/endpoint", jsonData, serverSentEventCallback: eventData =>
      {
          Debug.Log(eventData);
      });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
2 participants