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
{{ message }}
Repository navigation
apiFetch returns different types for preloaded, unparsed OPTIONS requests #37966
In #35527, the preloading middleware was updated to use preloaded OPTIONS requests only once, which matched a previous change for GET requests.
When the middleware returns preloaded data for a GET request with { parse: false }, it wraps the data in a Response object. But for OPTIONS requests, the middleware always returns a plain object, which means that preloaded OPTIONS requests return an object on the first call and a Response for all subsequent calls. As a developer, this inconsistency can affect me when:
I attempt to preload an OPTIONS request, but some other code makes the same request first.
Some other code preloads the OPTIONS request without my knowledge, but my code makes the request first.
At first glance, it seems to me that the expected behavior would be for the preloading middleware to return Response objects for unparsed OPTIONS requests like it does for GET requests.
Returning a Response would be a backwards compatibility break, but, on the other hand, #35527 itself is already a compatibility break (as was acknowledged at the time).
Activity
talldan commentedon Jan 14, 2022
cc @anton-vlasenko
anton-vlasenko commentedon Jan 14, 2022
I will look into this. Thanks, @talldan.