File tree Expand file tree Collapse file tree 2 files changed +20
-5
lines changed
Expand file tree Collapse file tree 2 files changed +20
-5
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @remix-run/router " : patch
3+ ---
4+
5+ Properly bubble headers when throwing a ` data() ` result
Original file line number Diff line number Diff line change @@ -5061,15 +5061,25 @@ async function convertDataStrategyResultToDataResult(
50615061 type : ResultType . error ,
50625062 error : result . data ,
50635063 statusCode : result . init ?. status ,
5064+ headers : result . init ?. headers
5065+ ? new Headers ( result . init . headers )
5066+ : undefined ,
50645067 } ;
50655068 }
50665069
50675070 // Convert thrown data() to ErrorResponse instances
5068- result = new ErrorResponseImpl (
5069- result . init ?. status || 500 ,
5070- undefined ,
5071- result . data
5072- ) ;
5071+ return {
5072+ type : ResultType . error ,
5073+ error : new ErrorResponseImpl (
5074+ result . init ?. status || 500 ,
5075+ undefined ,
5076+ result . data
5077+ ) ,
5078+ statusCode : isRouteErrorResponse ( result ) ? result . status : undefined ,
5079+ headers : result . init ?. headers
5080+ ? new Headers ( result . init . headers )
5081+ : undefined ,
5082+ } ;
50735083 }
50745084 return {
50755085 type : ResultType . error ,
You can’t perform that action at this time.
0 commit comments