You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For r.http(method="HEAD") requests we are currently returning None/null since that is the body of the result. While that is Ok for people who wish to use HEAD requests as a form of PING, it is not very useful for those who might be using it for grabbing things like ETags or Content-Disposition headers.
This is obviously not a priority (since no one has asked for it), but we should probably parse the headers and return them as an object.
+1 for this, it'd be awesome if we could get access to the Etags/headers. Would make it possible to have the query store the etag and send a proper If-None-Match header right from rethinkdb. It'd be nice to have one less step
I think we should make this change, and a quick look at the code shows it would be dead simple. I am concerned that the change is not backwards compatible, though. Luckily, since r.http is non-deterministic, we don't have to worry about breaking index compatibility, but we would still need to discuss this.
It would probably be nice if we could return the headers for non-HEAD requests as well. I'm not sure how that should look like when getting a stream from r.http though.
@danielmewes one option would be to create a new http_response pseudotype. The specifics of the API would need to be discussed, but it would give you guys a place to throw any of the HTTP request/response metadata (and not just headers). Since the drivers could just unwrap the psuedotype value (response body) when it gets deserialized, the server could return everything by default but not introduce a breaking change to user code. However, as you mentioned, things would still be tricky when the response is a stream.
@marshall007 Yeah I briefly thought about that too. That's probably the correct way for solving this.
It's also a fair bit of work to implement though, and we have to figure out the exact semantics of how the type can be cast into other types, and how its "fields" are accessed.
I think we might want to pick a simpler solution for the time being.
Activity
tarqd commentedon Sep 19, 2015
+1 for this, it'd be awesome if we could get access to the Etags/headers. Would make it possible to have the query store the etag and send a proper
If-None-Matchheader right from rethinkdb. It'd be nice to have one less stepTryneus commentedon Jan 8, 2016
I think we should make this change, and a quick look at the code shows it would be dead simple. I am concerned that the change is not backwards compatible, though. Luckily, since
r.httpis non-deterministic, we don't have to worry about breaking index compatibility, but we would still need to discuss this.tarqd commentedon Jan 8, 2016
Could add an option such as "{return_headers: true}" to enable new functionality
danielmewes commentedon Jan 8, 2016
@ilsken That's certainly an option.
It would probably be nice if we could return the headers for non-HEAD requests as well. I'm not sure how that should look like when getting a stream from
r.httpthough.marshall007 commentedon Jan 8, 2016
@danielmewes one option would be to create a new
http_responsepseudotype. The specifics of the API would need to be discussed, but it would give you guys a place to throw any of the HTTP request/response metadata (and not just headers). Since the drivers could just unwrap the psuedotype value (response body) when it gets deserialized, the server could return everything by default but not introduce a breaking change to user code. However, as you mentioned, things would still be tricky when the response is a stream.danielmewes commentedon Jan 11, 2016
@marshall007 Yeah I briefly thought about that too. That's probably the correct way for solving this.
It's also a fair bit of work to implement though, and we have to figure out the exact semantics of how the type can be cast into other types, and how its "fields" are accessed.
I think we might want to pick a simpler solution for the time being.