Skip to content

Need DownloadStreamAsync version that allows reading the status code? #1823

Closed

Description

@kendallb

Is your feature request related to a problem? Please describe.
Presently when you use DownloadStreamAsync, you just get the stream as a result. if the request fails for some reason, there is no way to get the status code (or as another user was asking for, a way to get the headers from the response also). In our case, sometimes we might get an unauthorized response if we need to regenerate auth key, so we check for that response, get the new auth key and then re-run the request. But we cannot do that if we cannot see the response status code.

Describe the solution you'd like
Either the DownloadStreamAsync function needs some functionality added to allow this, or a new overload created that would return the headers etc as well as the response data?

I think it was suggested previously that the response data could be made lazy, so you could read the response stream somehow via the normal Execute request if you need extra functionality from the download stream code?

Activity

  1. kendallb commented on Mar 31, 2022

    @kendallb
    ContributorAuthor

    Ahh, looking at the code I think your suggestion before might work here. I think we can use the OnAfterRequest callback for the request to be able to get the response message so we can do something useful with that (basically save it off to inspect later?) when the download action completes?

    If that is accurate we can close this out.

  2. stale commented on May 1, 2022

    @stale

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

  3. repo-ranger commented on May 1, 2022

    @repo-ranger

    ⚠️ This issue has been marked wontfix and will be closed in 3 days

  4. deleted a comment from stale on Jun 13, 2022
  5. stale commented on Aug 13, 2022

    @stale

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

  6. repo-ranger commented on Aug 13, 2022

    @repo-ranger

    ⚠️ This issue has been marked wontfix and will be closed in 3 days

  7. nssoft-rlagrange commented on Apr 6, 2023

    @nssoft-rlagrange

    Hi, sorry for reopening it, but how would you implement a workaround (at the very least throw an exception if not 20X is returned ) ?
    Right now, I don't see a way to know if the server returned an error, so the stream will contains the error message from the server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions