Create a RequestInit with some minimal typesafety on attributes.
Create a RequestInit with some minimal typesafety on attributes.
This method creates as light weight a RequestInit literal as possible from the provided parameters, so as to allow the browser to work through its default setting strategy.
It is actually quite difficult to work out the defaults, which parameters work together and which don't. Check the rules here in case of doubt: - ¶3.1.5 Requests - ¶6.3 Request class, especially the constructor function of the whatwg Fetch spec.
//todo: it would help a lot if there were a way to make this fully type safe