Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
evanlinjin committed Aug 13, 2022
1 parent 24853e5 commit 69a8b20
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 68 deletions.
54 changes: 0 additions & 54 deletions src/api.rs

This file was deleted.

18 changes: 4 additions & 14 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,12 +269,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {

pub(crate) struct Headers(hyper::HeaderMap);
impl bip78::receiver::Headers for Headers {
fn get_header(&self, key: &str) -> Option<&str> {
if let Some(value) = self.0.get(key) {
return value.to_str().ok();
}
None
}
fn get_header(&self, key: &str) -> Option<&str> { self.0.get(key)?.to_str().ok() }
}

async fn handle_web_req(
Expand Down Expand Up @@ -306,18 +301,13 @@ async fn handle_web_req(
let mut lnd = handler.client;

let headers = Headers(req.headers().to_owned());
let query = {
let uri = req.uri();
if let Some(query) = uri.query() {
Some(&query.to_owned());
}
None
};
let query = req.uri().query().map(ToString::to_string);
let body = req.into_body();
let bytes = hyper::body::to_bytes(body).await?;
dbg!(&bytes); // this is correct by my accounts
let reader = &*bytes;
let proposal = UncheckedProposal::from_request(reader, query, headers).unwrap();
let proposal =
UncheckedProposal::from_request(reader, query.as_deref(), headers).unwrap();
if proposal.is_output_substitution_disabled() {
panic!("Output substitution must be enabled");
}
Expand Down

0 comments on commit 69a8b20

Please sign in to comment.