Skip to content

Latest commit

 

History

History
39 lines (28 loc) · 878 Bytes

ht.md

File metadata and controls

39 lines (28 loc) · 878 Bytes

HTTP

Some basic implementation details:

GET /path => empty

return client_.get(uri)
    ->expect_status(200, 201, 202, 204)
    ->ignore_body()
    ->completion();

GET /path => binary

return client_.get(uri)
    ->expect_status(200, 201, 202, 204)
    ->stream_body([ca](const std::string &in) {
        return ca->append_body(in);
    })
    ->completion();

GET /path => JSON

return client_.get(uri)
    ->expect_status(200, 201, 202, 204)
    ->expect_content_type("application/javascript")
    ->completion();
json::parse(resp->body());

JSON => POST /path => JSON

return client_.get(uri)
    ->expect_status(200, 201, 202, 204)
    ->expect_content_type("application/javascript")
    ->body(json_in)
    ->completion();
json::parse(resp->body());

PB => POST /path