Skip to content
Discussion options

You must be logged in to vote

@drauschenbach you're right, that's a misleading doc example. the source code shows HttpResponse::Ok().insert_header(Accept(...)) which puts an Accept header on a response, but Accept is a request header per RFC 7231 §5.3.2.

it's just a lazy doc example demonstrating how to construct the type, not showing actual usage. the common_header! macro generates all the header types with the same pattern and the examples just show "here's how to build this struct" rather than where it belongs in a real request/response flow.

a server can technically send Accept in a response in one edge case: HTTP OPTIONS responses (to indicate what content types the endpoint accepts), but that's via the Accept he…

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@drauschenbach
Comment options

@sunnypatell
Comment options

Answer selected by drauschenbach
@drauschenbach
Comment options

@JohnTitor
Comment options

@sunnypatell
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants