File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " http " : " patch"
3+ " http-js " : " patch"
4+ ---
5+
6+ Allow skipping sending ` Origin ` header in HTTP requests by setting ` Origin ` header to an empty string when calling ` fetch ` .
Original file line number Diff line number Diff line change @@ -264,6 +264,14 @@ pub async fn fetch<R: Runtime>(
264264 }
265265 }
266266
267+ // In case empty origin is passed, remove it. Some services do not like Origin header
268+ // so this way we can remove it in explicit way. The default behaviour is still to set it
269+ if cfg ! ( feature = "unsafe-headers" )
270+ && headers. get ( header:: ORIGIN ) == Some ( & HeaderValue :: from_static ( "" ) )
271+ {
272+ headers. remove ( header:: ORIGIN ) ;
273+ } ;
274+
267275 if let Some ( data) = data {
268276 request = request. body ( data) ;
269277 }
You can’t perform that action at this time.
0 commit comments