requests-scala
requests-scala copied to clipboard
Exception in Requester.stream when response is 304, where response-header doesn't include "location"
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.