We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 558e14b commit cfd48b3Copy full SHA for cfd48b3
2 files changed
.changes/http-allow-skip-origin.md
@@ -0,0 +1,6 @@
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`.
plugins/http/src/commands.rs
@@ -264,6 +264,14 @@ pub async fn fetch<R: Runtime>(
264
}
265
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
275
if let Some(data) = data {
276
request = request.body(data);
277
0 commit comments