View API call in visual studio

Asked

Viewed 41 times

0

I am starting programming using Xamarin Forms and developing first call using a basic API, I want to see if the call to Endpoint is correct and return of it, there is some screen in Visual Studio 2019 to display what is being sent and the return?

Below the code I’m starting the tests.

public async void ExecuteLoginAsync(object sender, EventArgs e)
    {
        var user = new User();

        user.UserEmail = email.Text;
        user.UserPassword = password.Text;

        if (String.IsNullOrEmpty(user.UserEmail) || String.IsNullOrEmpty(user.UserPassword))
        {
            await DisplayAlert("", "Verifique seu e-mail e senha e tente novamente", "OK");
        }

        try
        {
           var httpClient = new HttpClient();

            var uri = new Uri("https://teste/appLogin");
            var data = JsonConvert.SerializeObject(user);
            var content = new StringContent(data, Encoding.UTF8, "application/json");
            HttpResponseMessage response = null;
            response = await httpClient.PostAsync(uri, content);

            if (!response.IsSuccessStatusCode)
            {
                throw new Exception("Erro");
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }

    }

The debug screen does not show the request nor the answer.

inserir a descrição da imagem aqui

  • A Debugger is no good?

  • debug does not show requests and responses from calling the API / JSON

  • But it will show the result that is in the variable response and the request data are also in the other variables

  • @Costamilam I added an image of the debug screen, see that there is no request information nor the answer

  • This Debugger seems strange, I was imagining something like this: https://devblogs.microsoft.com/devops/wp-content/uploads/sites/6/2016/07/image_thumb387.png. (just one example), where you can see the variables and their values, this looks just like an output console, or else missed creating a pause point

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.