Summary
Description
When a FastEdge function builds an outbound HTTP request and sets Content-Type: application/json, the header from the inbound request (Content-Type: application/x-www-form-urlencoded for form submissions) leaks through to the outbound call. The result is two Content-Type headers in the outbound request; downstream services (e.g. Telegram Bot API) see the wrong one and fail to parse the body.
Root cause: Request::builder().header(...) in the Rust http crate uses append semantics, not replace. If the outbound request is constructed from or inherits the inbound request's HeaderMap, calling .header("Content-Type", "application/json") adds a second value rather than overriding the existing one. send_request in FastEdge-sdk-rust/src/http_client.rs then forwards all headers verbatim.
Steps to reproduce
- Deploy a FastEdge function that receives a form POST (Content-Type: application/x-www-form-urlencoded)
- Build an outbound POST request with .header("Content-Type", "application/json") and a JSON body
- Echo the outbound request to httpbin or inspect Telegram API errors
- Observe: outbound Content-Type is application/x-www-form-urlencoded (or both values present), JSON body is rejected
Expected behavior
Explicitly set headers on the outbound request take precedence over any inherited inbound headers. Content-Type: application/json should be the only Content-Type forwarded.
Actual behavior
Inbound Content-Type leaks into outbound request. Telegram API returns "message text is empty" because it cannot parse the JSON body labeled as form data.
Workaround
Build the outbound request from scratch without copying inbound headers, or use HeaderMap::insert (not append) to replace the header before passing to send_request.
Affected component
FastEdge SDK (Rust) — send_request / http_client.rs
Summary
Description
When a FastEdge function builds an outbound HTTP request and sets Content-Type: application/json, the header from the inbound request (Content-Type: application/x-www-form-urlencoded for form submissions) leaks through to the outbound call. The result is two Content-Type headers in the outbound request; downstream services (e.g. Telegram Bot API) see the wrong one and fail to parse the body.
Root cause: Request::builder().header(...) in the Rust http crate uses append semantics, not replace. If the outbound request is constructed from or inherits the inbound request's HeaderMap, calling .header("Content-Type", "application/json") adds a second value rather than overriding the existing one. send_request in FastEdge-sdk-rust/src/http_client.rs then forwards all headers verbatim.
Steps to reproduce
Expected behavior
Explicitly set headers on the outbound request take precedence over any inherited inbound headers. Content-Type: application/json should be the only Content-Type forwarded.
Actual behavior
Inbound Content-Type leaks into outbound request. Telegram API returns "message text is empty" because it cannot parse the JSON body labeled as form data.
Workaround
Build the outbound request from scratch without copying inbound headers, or use HeaderMap::insert (not append) to replace the header before passing to send_request.
Affected component
FastEdge SDK (Rust) — send_request / http_client.rs