Skip to content

Commit 5c602d5

Browse files
torstenrudolfSteve
authored andcommitted
fix(webhook-gateway): bound subscription example requests
Co-authored-by: Steve <e010611543c2fb824246457dab086b3bf8de013fcc516d0b35d88236fc254ae3@buzz.block.builderlab.xyz> Signed-off-by: Torsten Rudolf <trudolf@squareup.com> Signed-off-by: Steve <e010611543c2fb824246457dab086b3bf8de013fcc516d0b35d88236fc254ae3@buzz.block.builderlab.xyz>
1 parent bb04371 commit 5c602d5

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎crates/buzz-webhook-gateway/examples/webhook_subscription.rs‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use buzz_webhook_gateway::subscription_artifact::{id, Content, KIND, RECORD_TYPE
33
use nostr::hashes::{sha256::Hash as Sha256Hash, Hash};
44
use nostr::nips::nip98::{HttpData, HttpMethod};
55
use nostr::{EventBuilder, EventId, JsonUtil, Keys, Kind, PublicKey, Tag, Url};
6+
use std::time::Duration;
67
use uuid::Uuid;
78

89
const USAGE: &str = "usage: webhook_subscription <http(s)://relay> <channel-uuid> <agent-pubkey> \
@@ -57,7 +58,12 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
5758
.payload(Sha256Hash::hash(body.as_bytes()))
5859
.to_authorization(&keys)
5960
.await?;
60-
let response = reqwest::Client::new()
61+
let client = reqwest::Client::builder()
62+
.connect_timeout(Duration::from_secs(5))
63+
.timeout(Duration::from_secs(10))
64+
.redirect(reqwest::redirect::Policy::none())
65+
.build()?;
66+
let response = client
6167
.post(url)
6268
.header("authorization", auth)
6369
.header("content-type", "application/json")

0 commit comments

Comments
 (0)