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>(
264
264
}
265
265
}
266
266
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
+
267
275
if let Some ( data) = data {
268
276
request = request. body ( data) ;
269
277
}
You can’t perform that action at this time.
0 commit comments