Return redirect count in response object
This commit is contained in:
parent
fec113e48f
commit
772f92037f
2 changed files with 5 additions and 1 deletions
|
@ -41,6 +41,7 @@ The response object is a namespace with the following elements:
|
||||||
- ~headers~: the response headers as a single string, separated by newlines.
|
- ~headers~: the response headers as a single string, separated by newlines.
|
||||||
- ~content~: the response content, as raw bytes.
|
- ~content~: the response content, as raw bytes.
|
||||||
- ~time~: the time the request took, in seconds.
|
- ~time~: the time the request took, in seconds.
|
||||||
|
- ~redirectCount~: the number of redirects.
|
||||||
|
|
||||||
If your endpoint returns text, you can use ~FromBytes~ from
|
If your endpoint returns text, you can use ~FromBytes~ from
|
||||||
[[https://github.com/mlochbaum/bqn-libs/blob/master/strings.bqn][bqn-libs/strings.bqn]] to decode UTF-8.
|
[[https://github.com/mlochbaum/bqn-libs/blob/master/strings.bqn][bqn-libs/strings.bqn]] to decode UTF-8.
|
||||||
|
|
5
curl.bqn
5
curl.bqn
|
@ -135,6 +135,8 @@ Perform←{𝕊 session:
|
||||||
|
|
||||||
rcode‿⟨code⟩←EasyGetinfoLong⟨session.sessionPtr,curlInfo.responseCode,⟨0⟩⟩
|
rcode‿⟨code⟩←EasyGetinfoLong⟨session.sessionPtr,curlInfo.responseCode,⟨0⟩⟩
|
||||||
"retrieving response code"Check rcode
|
"retrieving response code"Check rcode
|
||||||
|
rredirectcount‿⟨redirectCount⟩←EasyGetinfoLong⟨session.sessionPtr,curlInfo.redirectCount,⟨0⟩⟩
|
||||||
|
"retrieving redirect count"Check rredirectcount
|
||||||
rtime‿⟨time⟩←EasyGetinfoDouble⟨session.sessionPtr,curlInfo.totalTime,⟨0.0⟩⟩
|
rtime‿⟨time⟩←EasyGetinfoDouble⟨session.sessionPtr,curlInfo.totalTime,⟨0.0⟩⟩
|
||||||
"retrieving request time"Check rtime
|
"retrieving request time"Check rtime
|
||||||
|
|
||||||
|
@ -149,8 +151,9 @@ Perform←{𝕊 session:
|
||||||
|
|
||||||
{
|
{
|
||||||
code⇐code,
|
code⇐code,
|
||||||
time⇐time,
|
|
||||||
headers⇐responseHeaders,
|
headers⇐responseHeaders,
|
||||||
content⇐content,
|
content⇐content,
|
||||||
|
time⇐time,
|
||||||
|
redirectCount⇐redirectCount,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue