-
Notifications
You must be signed in to change notification settings - Fork 553
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
http/client: add post()
method helper
#16718
Conversation
The iobuf already exists in memory and can be used directly as the body for the http request. Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
/ci-repeat 1 |
new failures in https://buildkite.com/redpanda/redpanda/builds/45365#018de81e-602e-4fc2-a322-7c245141bc21:
|
ducktape was retried in https://buildkite.com/redpanda/redpanda/builds/45365#018de81e-602b-40dd-8120-40feda2e92e2 ducktape was retried in https://buildkite.com/redpanda/redpanda/builds/45365#018de82f-ddb5-4d47-b67c-2638951c4b57 ducktape was retried in https://buildkite.com/redpanda/redpanda/builds/45377#018de8eb-d79f-47ee-b685-15220e91142c ducktape was retried in https://buildkite.com/redpanda/redpanda/builds/45386#018de97b-25f5-437a-a451-af02dc8a0ef6 ducktape was retried in https://buildkite.com/redpanda/redpanda/builds/45386#018de97b-25f1-4b28-a322-1f337fb525c1 |
Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
When requests are made without a host header field then one is automatically added using the host/port from the transport config. Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
/ci-repeat 1 |
http::client::request_header | ||
metrics_reporter::make_header(const iobuf& buffer) { | ||
http::client::request_header header; | ||
header.method(boost::beast::http::verb::post); | ||
header.target(std::string(_address.path)); | ||
header.insert( | ||
boost::beast::http::field::content_length, | ||
fmt::format("{}", buffer.size_bytes())); | ||
header.insert( | ||
boost::beast::http::field::host, | ||
fmt::format("{}:{}", _address.host, _address.port)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice simplification -- glad callers won't have to deal with headers anymore.
cc @Lazin can you take a look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Adds a
http::client::post
method which handles preparation of a post request as a convenience for the metrics reporter which is switched over to use this method.Backports Required
Release Notes