If I first use this code:
... applyAfterware({ response }, next) { console.log(response) ...
I have this:
Response {type: "cors", url: "localhost:8080/api", redirected: false, status: 200, ok: true, …} body: ReadableStream bodyUsed: true headers: Headers ok: true redirected: false status: 200 statusText: "OK" type: "cors" url: "localhost:8080/api" proto: Response
I can't read body.
So I found this:
github.com/apollographql/apollo-cl...
and now I'm using:
... const handleErrors = ({ response }, next) => { // clone response so we can turn it into json independently const res = response.clone() ...
And now I can use res.
But what I don't knowis why .clone()? Because response is a response?
After all I need to destroy res? How?
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
If I first use this code:
...
applyAfterware({ response }, next) {
console.log(response)
...
I have this:
Response {type: "cors", url: "localhost:8080/api", redirected: false, status: 200, ok: true, …}
body: ReadableStream
bodyUsed: true
headers: Headers
ok: true
redirected: false
status: 200
statusText: "OK"
type: "cors"
url: "localhost:8080/api"
proto: Response
I can't read body.
So I found this:
github.com/apollographql/apollo-cl...
and now I'm using:
...
const handleErrors = ({ response }, next) => {
// clone response so we can turn it into json independently
const res = response.clone()
...
And now I can use res.
But what I don't knowis why .clone()? Because response is a response?
After all I need to destroy res? How?