Skip to content

Fix HTTP error handling in payjoin-cli#1499

Merged
spacebear21 merged 1 commit intopayjoin:masterfrom
spacebear21:fix-http-error-handling-cli
Apr 22, 2026
Merged

Fix HTTP error handling in payjoin-cli#1499
spacebear21 merged 1 commit intopayjoin:masterfrom
spacebear21:fix-http-error-handling-cli

Conversation

@spacebear21
Copy link
Copy Markdown
Collaborator

@spacebear21 spacebear21 commented Apr 22, 2026

While testing @Arowolokehinde 's PR #1498 I noticed that cli was attempting to process the OHTTP response even though it was returning a 403. This fix ensures we actually bubble up HTTP error responses from the ohttp relay:

Before:

❯ cargo run -- send $BIP21 --fee-rate 1
   Compiling payjoin-cli v0.2.0 (/Users/spacebear/Projects/rust-payjoin/payjoin-cli)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.63s
     Running `/Users/spacebear/Projects/rust-payjoin/target/debug/payjoin-cli send 'bitcoin:bcrt1qpvnwwzs00tjys006szgx26krf8kewmk8qah2ah?amount=0.00001&pjos=0&pj=HTTPS://PAYJO.IN/8EZPMVL7YVTHZ%23EX1C4PW56G-OH1QYPFLM8XL59R0XV4VGPLS7FRDSSM4TUXL07TXCWC4S0GLVLNK2SE4NQ-RK1QDN0WY7AAH7YLXKJYHEN7SSDT04WG2JKMDY3UGGGWDU8S6X9GXSZG' --fee-rate 1`
Bootstrapping private network transport over Oblivious HTTP
Error: Transient error: Directory response error: Unexpected response size 0, expected 8192 bytes

After:

❯ cargo run -- send $BIP21 --fee-rate 1
   Compiling payjoin-cli v0.2.0 (/Users/spacebear/Projects/rust-payjoin/payjoin-cli)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.89s
     Running `/Users/spacebear/Projects/rust-payjoin/target/debug/payjoin-cli send 'bitcoin:bcrt1qpvnwwzs00tjys006szgx26krf8kewmk8qah2ah?amount=0.00001&pjos=0&pj=HTTPS://PAYJO.IN/8EZPMVL7YVTHZ%23EX1C4PW56G-OH1QYPFLM8XL59R0XV4VGPLS7FRDSSM4TUXL07TXCWC4S0GLVLNK2SE4NQ-RK1QDN0WY7AAH7YLXKJYHEN7SSDT04WG2JKMDY3UGGGWDU8S6X9GXSZG' --fee-rate 1`
Bootstrapping private network transport over Oblivious HTTP
Error: HTTP request failed

Caused by:
    HTTP status client error (403 Forbidden) for url (https://payjo.in/https://payjo.in/)

Closes #1394

Pull Request Checklist

Please confirm the following before requesting review:

It was not handling HTTP error status codes correctly since any response
is considered successful by reqwest without `error_for_status()`.
@coveralls
Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 24789507463

Coverage increased (+0.03%) to 84.953%

Details

  • Coverage increased (+0.03%) from the base build.
  • Patch coverage: 2 of 2 lines across 1 file are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 13371
Covered Lines: 11359
Line Coverage: 84.95%
Coverage Strength: 400.76 hits per line

💛 - Coveralls

@arminsabouri arminsabouri self-requested a review April 22, 2026 16:31
Copy link
Copy Markdown
Collaborator

@arminsabouri arminsabouri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK 79da53c

@spacebear21 spacebear21 merged commit 2cca296 into payjoin:master Apr 22, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

payjoin-cli "send" doesn't propagate process_response errors correctly

3 participants