Skip to content

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

@andreak

Description

@andreak

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions