Skip to content

Commit

Permalink
test(core): Update network_reader_with_valid_http_header_kv_pairs t…
Browse files Browse the repository at this point in the history
…o verify the return value before parsing the read content into a JSON object. (y-scope#593)
  • Loading branch information
LinZhihao-723 authored Nov 15, 2024
1 parent 477130d commit ac4f1c1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions components/core/tests/test-NetworkReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,10 @@ TEST_CASE("network_reader_with_valid_http_header_kv_pairs", "[NetworkReader]") {
clp::NetworkReader::cDefaultBufferSize,
valid_http_header_kv_pairs
};
auto const content = nlohmann::json::parse(get_content(reader));
auto const& headers{content.at("headers")};
auto const content{get_content(reader)};
REQUIRE(assert_curl_error_code(CURLE_OK, reader));
auto const parsed_content = nlohmann::json::parse(content);
auto const& headers{parsed_content.at("headers")};
for (auto const& [key, value] : valid_http_header_kv_pairs) {
REQUIRE((value == headers.at(key).get<std::string_view>()));
}
Expand Down

0 comments on commit ac4f1c1

Please sign in to comment.