Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: drop Host header in https outcall request #1068

Merged
merged 2 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion motoko/send_http_post/src/send_http_post_backend/main.mo
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ actor {
//idempotency keys should be unique so we create a function that generates them.
let idempotency_key : Text = generateUUID();
let request_headers = [
{ name = "Host"; value = host # ":443" },
{ name = "User-Agent"; value = "http_post_sample" },
{ name = "Content-Type"; value = "application/json" },
{ name = "Idempotency-Key"; value = idempotency_key },
Expand Down
4 changes: 0 additions & 4 deletions rust/send_http_get/src/send_http_get_backend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ async fn get_icp_usd_exchange() -> String {
// 2.2 prepare headers for the system http_request call
//Note that `HttpHeader` is declared in line 4
let request_headers = vec![
HttpHeader {
name: "Host".to_string(),
value: format!("{host}:443"),
},
HttpHeader {
name: "User-Agent".to_string(),
value: "exchange_rate_canister".to_string(),
Expand Down
6 changes: 1 addition & 5 deletions rust/send_http_post/src/send_http_post_backend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ async fn send_http_post_request() -> String {
// 2.2 prepare headers for the system http_request call
//Note that `HttpHeader` is declared in line 4
let request_headers = vec![
HttpHeader {
name: "Host".to_string(),
value: format!("{host}:443"),
},
HttpHeader {
name: "User-Agent".to_string(),
value: "demo_HTTP_POST_canister".to_string(),
Expand Down Expand Up @@ -191,4 +187,4 @@ fn transform(raw: TransformArgs) -> HttpResponse {
ic_cdk::api::print(format!("Received an error from coinbase: err = {:?}", raw));
}
res
}
}
Loading