本文整理汇总了C++中HTTPMessage::getMethod方法的典型用法代码示例。如果您正苦于以下问题:C++ HTTPMessage::getMethod方法的具体用法?C++ HTTPMessage::getMethod怎么用?C++ HTTPMessage::getMethod使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTTPMessage
的用法示例。
在下文中一共展示了HTTPMessage::getMethod方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
TEST(HTTPMessage, TestMethod) {
HTTPMessage msg;
msg.setMethod(HTTPMethod::GET);
EXPECT_EQ("GET", msg.getMethodString());
EXPECT_EQ(HTTPMethod::GET == msg.getMethod(), true);
msg.setMethod("FOO");
EXPECT_EQ("FOO", msg.getMethodString());
EXPECT_EQ(boost::none == msg.getMethod(), true);
msg.setMethod(HTTPMethod::CONNECT);
EXPECT_EQ("CONNECT", msg.getMethodString());
EXPECT_EQ(HTTPMethod::CONNECT == msg.getMethod(), true);
}
示例2: sendHeadersWithOptionalEOM
void HTTPTransaction::sendHeadersWithOptionalEOM(
const HTTPMessage& headers,
bool eom) {
CHECK(HTTPTransactionEgressSM::transit(
egressState_, HTTPTransactionEgressSM::Event::sendHeaders));
DCHECK(!isEgressComplete());
if (isDownstream() && !isPushed()) {
lastResponseStatus_ = headers.getStatusCode();
}
if (headers.isRequest()) {
headRequest_ = (headers.getMethod() == HTTPMethod::HEAD);
}
HTTPHeaderSize size;
transport_.sendHeaders(this, headers, &size, eom);
if (transportCallback_) {
transportCallback_->headerBytesGenerated(size);
}
if (eom) {
CHECK(HTTPTransactionEgressSM::transit(
egressState_, HTTPTransactionEgressSM::Event::sendEOM));
// trailers are supported in this case:
// trailers are for chunked encoding-transfer of a body
if (transportCallback_) {
transportCallback_->bodyBytesGenerated(0);
}
CHECK(HTTPTransactionEgressSM::transit(
egressState_, HTTPTransactionEgressSM::Event::eomFlushed));
}
flushWindowUpdate();
}
示例3: generateHeader
void HTTPChecks::generateHeader(folly::IOBufQueue& writeBuf,
StreamID stream,
const HTTPMessage& msg,
StreamID assocStream,
HTTPHeaderSize* sizeOut) {
if (msg.isRequest() && RFC2616::bodyImplied(msg.getHeaders())) {
CHECK(RFC2616::isRequestBodyAllowed(msg.getMethod()) !=
RFC2616::BodyAllowed::NOT_ALLOWED);
// We could also add a "strict" mode that disallows sending body on GET
// requests here too.
}
call_->generateHeader(writeBuf, stream, msg, assocStream, sizeOut);
}