Using a REST API block, is there a way to get headers from a non-200 response?

I have an API call that needs to fail once and supply a CSRF token, and then I can use that token in a retry set to a x-csrf-token token.

I'm attempting to migrate a Budibase automation to a Retool workflow. In Budibase, there's the idea of dynamic variables and REST requests retrying once on failure, filling in things like x-csrf-token with a dynamic variable if the failed request supplies it via dynamic variables.

It seemed like I should've just been able to grab the token via query.metadata.headers but the failed request and query doesn't seem to provide headers or any metadata at all.

Is there a work around?

Hey @rjoll! Is the API you're hitting public? Failed requests can still contain header metadata, if you're not seeing it get returned it would be great if there were something we could test against or any additional information you could share to help narrow down the context in which it's failing. That might also help with potential workarounds.