Add support for additional headers

This commit is contained in:
Arun M 2017-12-29 14:44:17 +05:30
parent 7ddf7ec3e9
commit 161e5d8753
4 changed files with 133 additions and 48 deletions

View file

@ -259,6 +259,31 @@ TEST (EncodeTest, OverwriteClaimsTest)
EXPECT_TRUE (obj.payload().has_claim_with_value("x-pld1", "1data"));
}
TEST (EncodeTest, HeaderParamTest)
{
using namespace jwt::params;
jwt::jwt_object obj{
headers({
{"alg", "none"},
{"typ", "jwt"},
}),
payload({
{"iss", "arun.muralidharan"},
{"sub", "nsfw"},
{"x-pld", "not my ex"}
})
};
bool ret = obj.header().add_header("kid", 1234567);
EXPECT_TRUE (ret);
ret = obj.header().add_header("crit", std::array<std::string, 1>{"exp"});
EXPECT_TRUE (ret);
std::cout << obj.header() << std::endl;
}
int main(int argc, char **argv)
{
::testing::InitGoogleTest(&argc, argv);