mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-20 04:28:10 +00:00
Fixed content type parsing + added test
This commit is contained in:
parent
8f2be0252a
commit
3a6fe51939
2 changed files with 11 additions and 2 deletions
|
|
@ -79,7 +79,7 @@ ContentType::ContentType (const string &contentType) : Header(*new ContentTypePr
|
|||
token = params.substr(0, posParam);
|
||||
}
|
||||
addParameter(HeaderParam(token));
|
||||
params.erase(0, pos + 1);
|
||||
params.erase(0, posParam + 1);
|
||||
} while (posParam != std::string::npos);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -352,9 +352,18 @@ void list_to_multipart () {
|
|||
BC_ASSERT_TRUE(originalStr == generatedStr);
|
||||
}
|
||||
|
||||
static void content_type_parsing(void) {
|
||||
const string type = "message/external-body;access-type=URL;URL=\"https://www.linphone.org/img/linphone-open-source-voip-projectX2.png\"";
|
||||
ContentType contentType = ContentType(type);
|
||||
BC_ASSERT_STRING_EQUAL("message", contentType.getType().c_str());
|
||||
BC_ASSERT_STRING_EQUAL("external-body", contentType.getSubType().c_str());
|
||||
BC_ASSERT_TRUE(type == contentType.asString());
|
||||
}
|
||||
|
||||
test_t content_manager_tests[] = {
|
||||
TEST_NO_TAG("Multipart to list", multipart_to_list),
|
||||
TEST_NO_TAG("List to multipart", list_to_multipart)
|
||||
TEST_NO_TAG("List to multipart", list_to_multipart),
|
||||
TEST_NO_TAG("Content type parsing", content_type_parsing)
|
||||
};
|
||||
|
||||
test_suite_t content_manager_test_suite = {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue