当前位置: 首页>>代码示例>>C++>>正文


C++ HTTPMessage::getMethod方法代码示例

本文整理汇总了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);
}
开发者ID:abhiguru,项目名称:proxygen,代码行数:15,代码来源:HTTPMessageTest.cpp

示例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();
}
开发者ID:abhiguru,项目名称:proxygen,代码行数:30,代码来源:HTTPTransaction.cpp

示例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);
}
开发者ID:AlexJiaeHwang,项目名称:proxygen,代码行数:14,代码来源:HTTPChecks.cpp


注:本文中的HTTPMessage::getMethod方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。