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
This leads to problems when the host header is a required header, in case you want to do a request to an external application that requires both an IP address and a host header value (for routing the request to the right context).
fetch should really just be used for cases where isomorphic code is required, e.g. libraries. It's simply not the right tool for back end development in general.
Reacted by Oliver Salzburg
Reacted by Rasmus Porsager, Maikel van Dort, Alexey Kotlyarov, Matej Černý, Dmitry Ivanov, edisionnano, Eli Gao, Nagol12344, Manaf941, Ninh Pham and 6 more
I think this is probably one of those cases where you shoulnd't be using fetch. Use undici.request instead.
I am in a sticky situation where I need to set the Host header but I also need to return a fetch Response object. Does Undici provide a method of converting the undici.request response to a fetch Response?
Reacted by Srgjan Dimitrijevikj, Steven, Ivan Charapanau, Will Stamper, Justin Maher, rriski, Blake Williams, Blake Williams, Erin Thompson, Alban Mouton and 4 more
Activity
ronag commentedon Oct 23, 2023
I think this is probably one of those cases where you shoulnd't be using fetch. Use
undici.requestinstead.paulrutter commentedon Oct 23, 2023
@ronag does that mean that my application then has to add a dependency on
undici, and thus not use Node.jsfetch?ronag commentedon Oct 23, 2023
Correct.
ronag commentedon Oct 23, 2023
fetch should really just be used for cases where isomorphic code is required, e.g. libraries. It's simply not the right tool for back end development in general.
paulrutter commentedon Oct 23, 2023
Ok, that makes sense. Will have a go with that approach.
MattyBalaam commentedon Oct 1, 2024
I am in a sticky situation where I need to set the Host header but I also need to return a fetch Response object. Does Undici provide a method of converting the undici.request response to a fetch Response?