mirror of
https://github.com/ossrs/srs.git
synced 2025-02-14 20:31:56 +00:00
Improve test coverage for HTTP header.
This commit is contained in:
parent
8c10c26f00
commit
0886acbdb7
1 changed files with 25 additions and 0 deletions
|
@ -128,3 +128,28 @@ VOID TEST(ProtocolHTTPTest, ResponseHTTPError)
|
|||
EXPECT_STREQ(mock_http_response(302,"Found").c_str(), HELPER_BUFFER2STR(&w.io.out_buffer).c_str());
|
||||
}
|
||||
}
|
||||
|
||||
VOID TEST(ProtocolHTTPTest, HTTPHeader)
|
||||
{
|
||||
SrsHttpHeader h;
|
||||
h.set("Server", "SRS");
|
||||
EXPECT_STREQ("SRS", h.get("Server").c_str());
|
||||
|
||||
stringstream ss;
|
||||
h.write(ss);
|
||||
EXPECT_STREQ("Server: SRS\r\n", ss.str().c_str());
|
||||
|
||||
h.del("Server");
|
||||
EXPECT_TRUE(h.get("Server").empty());
|
||||
|
||||
EXPECT_EQ(-1, h.content_length());
|
||||
|
||||
h.set_content_length(0);
|
||||
EXPECT_EQ(0, h.content_length());
|
||||
|
||||
h.set_content_length(1024);
|
||||
EXPECT_EQ(1024, h.content_length());
|
||||
|
||||
h.set_content_type("text/plain");
|
||||
EXPECT_STREQ("text/plain", h.content_type().c_str());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue