Skip to content
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
9 changes: 9 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ The design target is extensible, cross-platform, and mobile-friendly networking
Preserve clear layering and strong architectural boundaries; do not introduce shortcut designs that make the system harder to evolve
Treat code as the source of truth and keep documentation aligned with actual behavior

## RFC Conformance

- Strict conformance to applicable network protocol RFCs is a design and release requirement for every supported feature. Code records actual behavior; applicable RFCs define required protocol behavior. Resolve conflicts by fixing implementation and tests.
- Identify the RFC sections, endpoint role, applicable conditions, updates, and verified errata before changing protocol behavior. Record the mapping from requirements to implementation owners, independent expected values, tests, and verification status.
- Applicable MUST/MUST NOT requirements are release blockers. Follow SHOULD/SHOULD NOT by default; any RFC-permitted exception needs its specific rationale and tests. Explicitly record MAY choices and supported scope without claiming optional features are mandatory.
- Do not substitute existing behavior, OkHttp compatibility, or a dependency accepting input for protocol evidence. Compatibility choices must remain within the applicable RFC's permitted behavior.
- Derive positive, negative, wire, and failure-path tests from the specification. Probability arguments alone do not establish a protocol invariant when deterministic validation is possible.
- Do not claim conformance for unimplemented or unverified behavior. Fix or explicitly block affected work on discovered violations; this requirement does not imply that the existing library has completed a full conformance audit.

Treat the following as the canonical execution chain of the project:
```
User API
Expand Down
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ blocks, and stable observability hooks.
HTTP/2 protocol binding
- `RequestBody::absent()` for typical no-body requests and
`RequestBody::explicit_empty()` when zero-length framing must be explicit
- `RequestBody::content_length()` independent of replayability, plus DATA-only
`concat` and `from_stream_with_length` for known-length one-shot bodies
- optional `multipart` form encoder (`Form` / `Part`) that produces an ordinary
`RequestBody` and owns `Content-Type` before `Client::execute`
- optional JSON helpers behind the `json` feature
- optional WebSocket (RFC 6455) client behind the `websocket` feature, with a
pluggable `WebSocketEngine` trait and a built-in native codec
Expand Down Expand Up @@ -104,6 +108,7 @@ Optional features:
| `cookies` | yes | Built-in `Jar` (`cookie_store` + public suffix list) |
| `json` | no | `RequestBody::from_json` / `ResponseBody::json`, JSON pretty-print in `LoggerInterceptor` |
| `websocket` | no | RFC 6455 WebSocket client |
| `multipart` | no | `multipart/form-data` encoder (`Form` / `Part`) |

Optional companion crates are published with the same workspace version, for
example `openwire-cache = "0.1.2"` or `openwire-tungstenite = "0.1.2"`.
Expand Down Expand Up @@ -176,6 +181,35 @@ let response = queued.await_response().await?;
Dropping `QueuedCall` does not request cancellation; call `cancel()` on the
queued call or its `CallHandle` when the in-flight work should stop.

## Multipart Uploads

Enable the `multipart` feature and build the form before `Client::execute`.
`Form::into_request` replaces any existing `Content-Type` with the generated
`multipart/form-data` value and clears stale framing headers. A known length
does not make a stream replayable:

```rust
use bytes::Bytes;
use http::Request;
use openwire::{multipart::{Form, Part}, Client};

let client = Client::builder().build()?;
let request = Form::new()
.text("description", "upload from OpenWire")
.part(
"file",
Part::bytes(Bytes::from_static(b"hello\n"))
.file_name("hello.txt")
.mime_str("text/plain; charset=utf-8")?,
)
.into_request(
Request::builder()
.method("POST")
.uri("https://example.com/upload"),
)?;
let response = client.execute(request).await?;
```

## Authentication Challenges

`Authenticator` receives an `AuthContext` for origin `401 Unauthorized`,
Expand Down
Loading
Loading