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

One SendRequest makes multiple API calls #490

Closed
NitinNotebook opened this issue Jan 17, 2020 · 12 comments
Closed

One SendRequest makes multiple API calls #490

NitinNotebook opened this issue Jan 17, 2020 · 12 comments
Labels

Comments

@NitinNotebook
Copy link

Version: 1.41.1 (system setup)
Date: 2019-12-18T14:58:56.166Z
Electron: 6.1.5
Chrome: 76.0.3809.146
Node.js: 12.4.0 V8: 7.6.303.31-electron.0
OS: Windows_NT x64 10.0.18363

  • REST Client Version: 0.23.0

Steps to Reproduce:

  1. Define the Rest API request in "Request.rest" file
    @authtoken = ----AAD user Id Token Value----
    @hostUrl = http://localhost:7071
    get {{hostUrl}}/api/GetUserResources
    content-type: application/json
    Authorization: Bearer {{authToken}}
    fiscalYear: 2020

  2. Start Debugging in VS 2019 for the Azure Function App and put the debug point in the entry function.

  3. Click on the SendRequest link visible in the file.

  4. For one time click, same api is called three times. Debug point hits 3 times. The response in VS code is shown after all 3 calls are complete. This causes very slow feedback loop.

@Huachao
Copy link
Owner

Huachao commented Jan 17, 2020

@nitinmahajan10 it seems doesn't possible for me. Did you Azure function app will return 3XX or 401 response? You can set the rest-client.followredirect to false to verify if redirection happens

@NitinNotebook
Copy link
Author

@Huachao thanks for quick response. I checked the behavior is when response is "500 Internal Server Error" or returning this:
return new ExceptionResult(ex, true);

This happens even after setting :
"rest-client.followredirect": false

@Huachao
Copy link
Owner

Huachao commented Jan 20, 2020

@nitinmahajan10 do you mean no matter enable redirection or not, click Send Request once will always hit your Azure Function App three times? And if so, what's the response of each call at the server side?

@brentahughes
Copy link

I'm getting the same behavior. If my rest service returns a 500 it will attempt 3 times before returning the response. If the response is a 200 it only makes a single call.

It seems as if there is some error handling to automatically retry the request up to 3 times. If this is the case then a setting to disable or set the number of retries would be nice.

@brentahughes
Copy link

Looks like this is coming from

It's hardcoded to retry twice on EOL

@Huachao
Copy link
Owner

Huachao commented Jan 21, 2020

@brentahughes @nitinmahajan10 the root cause is that the underlying httpclient package got will automatically retry on specific response status codes. I have fixed this issue and will be published in the next release.

@Huachao Huachao closed this as completed Jan 21, 2020
@Huachao
Copy link
Owner

Huachao commented Jan 21, 2020

@brentahughes @nitinmahajan10 you can verify this in the latest version 0.23.1

@d-akara
Copy link
Contributor

d-akara commented Feb 7, 2020

@Huachao This update has broken my usage of the REST Client. I'm not exactly sure which change broke, but I suspect this one. There are a lot of redirects that happen on login attempt and now I can't successfully login after this update.

If there is some logging I can enable on the Rest Client or something, maybe I could be more specific.

@Huachao
Copy link
Owner

Huachao commented Feb 7, 2020

@dakaraphi you mean a lot of redirects happened in the login API? Are there any redirected URLs contains port number in it?

@d-akara
Copy link
Contributor

d-akara commented Feb 7, 2020

I honestly don't know exactly what is happening. I'm just aware that redirects are sometimes used. It is not an area of code I work on, so I'm going to have to figure out a way to debug the problem. It will not be easy from the server side as it is very complex, so I was hoping there was some way of logging in more detail what is happening with the client.

@Huachao
Copy link
Owner

Huachao commented Feb 7, 2020

@dakaraphi can you try if this version of extension works, you need to install it in the Extensions sidebar, and Click the ... and the Install from VSIX option. Note, you need to first remove the trailing .txt text in the file name.

rest-client-0.23.1.vsix.txt

@d-akara
Copy link
Contributor

d-akara commented Feb 7, 2020

It does not work. So must be some other change. I will create a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants