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(
5061
5061
type : ResultType . error ,
5062
5062
error : result . data ,
5063
5063
statusCode : result . init ?. status ,
5064
+ headers : result . init ?. headers
5065
+ ? new Headers ( result . init . headers )
5066
+ : undefined ,
5064
5067
} ;
5065
5068
}
5066
5069
5067
5070
// 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
+ } ;
5073
5083
}
5074
5084
return {
5075
5085
type : ResultType . error ,
You can’t perform that action at this time.
0 commit comments