| 378 | } |
| 379 | |
| 380 | int RequestData::header(lua_State *L) |
| 381 | { |
| 382 | RequestData *d = checkItem(L, 1); |
| 383 | if (!d || !d->reply) |
| 384 | { |
| 385 | lua_pushnil(L); |
| 386 | return 1; |
| 387 | } |
| 388 | const auto &headers = d->reply->rawHeaderPairs(); |
| 389 | lua_newtable(L); // table |
| 390 | for (auto &p : headers) |
| 391 | { |
| 392 | lua_pushlstring(L, p.first.constData(), p.first.size()); // table key |
| 393 | lua_pushlstring(L, p.second.constData(), p.second.size()); // table key value |
| 394 | lua_rawset(L, -3); // table |
| 395 | } |
| 396 | return 1; |
| 397 | } |
| 398 | |
| 399 | int RequestData::content(lua_State *L) |
| 400 | { |
no test coverage detected