Allow http calls without origin header

Example Clerk auth provider does not work when both Authorization and
Origin headers are set. This allows one to skip setting the origin
header explicitly.
pull/1941/head
Niko Korvenlaita 10 months ago
parent 7e1c17a635
commit 9dd62746ff
No known key found for this signature in database
GPG Key ID: 4FFC33D57FBE9575

@ -264,6 +264,14 @@ pub async fn fetch<R: Runtime>(
}
}
// In case empty origin is passed, remove it. Some services do not like Origin header
// so this way we can remove it in explicit way. The default behaviour is still to set it
if cfg!(feature = "unsafe-headers")
&& headers.get(header::ORIGIN) == Some(&HeaderValue::from_static(""))
{
headers.remove(header::ORIGIN);
};
if let Some(data) = data {
request = request.body(data);
}

Loading…
Cancel
Save