MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1qqxmi8/maybeusetheoriginheaderinstead/o5g4kqq/?context=3
r/ProgrammerHumor • u/MurkyWar2756 • Jan 30 '26
13 comments sorted by
View all comments
Show parent comment
2
Uhh, that's how it works I thought?
You can just compact .then(reduce => reduce.json()) to .then(json)
But now that I'm writing it, I think I'm getting it confused with something
4 u/turtle_mekb Feb 15 '26 .then(json) only works if json is already a defined variable, like JSON.stringify 2 u/jessepence Feb 15 '26 Yeah, the problem is that the response object is not instantiated until after the first promise is fulfilled. So, there's no way to get a reference to the Response's JSON method because it doesn't exist yet.
4
.then(json) only works if json is already a defined variable, like JSON.stringify
.then(json)
json
JSON.stringify
2 u/jessepence Feb 15 '26 Yeah, the problem is that the response object is not instantiated until after the first promise is fulfilled. So, there's no way to get a reference to the Response's JSON method because it doesn't exist yet.
Yeah, the problem is that the response object is not instantiated until after the first promise is fulfilled. So, there's no way to get a reference to the Response's JSON method because it doesn't exist yet.
View all comments
Show parent comment
2
u/gojukebox Feb 15 '26
Uhh, that's how it works I thought?
You can just compact .then(reduce => reduce.json()) to .then(json)
But now that I'm writing it, I think I'm getting it confused with something