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

Exception in Requester.stream when response is 304, where response-header doesn't include "location" #120

Open
mr-cloud opened this issue Sep 12, 2022 · 0 comments

Comments

@mr-cloud
Copy link
Owner

Using version 0.7.0
When receiving 304 "not modified" this code throws NoSuchElementException:

        if (responseCode.toString.startsWith("3") && maxRedirects > 0){
          val out = new ByteArrayOutputStream()
          Util.transferTo(connection.getInputStream, out)
          val bytes = out.toByteArray

          val current = Response(
            url,
            responseCode,
            responseMsg,
            new geny.Bytes(bytes),
            headerFields,
            redirectedFrom
          )
          persistCookies()
          val newUrl = current.headers("location").head

On line 309 val newUrl = current.headers("location").head
Sending location in 304 response is not required.
ID: 105
Original Author: andreak
link: Original Link

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

No branches or pull requests

1 participant