Public Types | Public Member Functions | List of all members
Request Struct Reference

#include <HttpRequest.h>

Public Types

enum  RetryOption { DontRetry, ResetTransfer, ResumeTransfer }
 
typedef std::function< void(double
bytesTransfered, double
bytesTotal)> 
ProgressCallback
 
typedef const ProgressCallbackProgressCallbackCR
 

Public Member Functions

BEHTTP_EXPORT Utf8String EscapeUnsafeSymbolsInUrl (Utf8StringCR url)
 
BEHTTP_EXPORT Request (Utf8StringCR url, Utf8StringCR method="GET")
 
HttpRequestHeadersR GetHeaders ()
 
HttpRequestHeadersCR GetHeaders () const
 
Utf8StringCR GetUrl () const
 
Utf8StringCR GetMethod () const
 
void SetValidateCertificate (bool validate)
 Enable or disable server certificate and hostname validation. More...
 
bool GetValidateCertificate () const
 
void SetProxy (Utf8StringCR proxyUrl)
 
Utf8StringCR GetProxy () const
 
void SetRequestBody (HttpBodyPtr body)
 
HttpBodyPtr GetRequestBody () const
 
void SetResponseBody (HttpBodyPtr body)
 
HttpBodyPtr GetResponseBody () const
 
void SetTimeoutSeconds (unsigned connectionAndTransferTimeout)
 Sets connection and transfer timeouts with one value. Default - 60 seconds. More...
 
void SetConnectionTimeoutSeconds (unsigned connectionTimeout)
 
unsigned GetConnectionTimeoutSeconds () const
 
void SetTransferTimeoutSeconds (unsigned transferTimeout)
 
unsigned GetTransferTimeoutSeconds () const
 
void SetFollowRedirects (bool follow)
 Enable or disable following redirects. Default is true. More...
 
bool GetFollowRedirects () const
 
void SetUseNewConnection (bool useNewConnection)
 
bool GetUseNewConnection () const
 
void SetRetryOptions (RetryOption option, unsigned maximumRetries=1)
 
RetryOption const & GetRetryOption () const
 
unsigned GetMaxRetries () const
 
void SetCancellationToken (Tasks::ICancellationTokenPtr token)
 
Tasks::ICancellationTokenPtr GetCancellationToken () const
 
void SetDownloadProgressCallback (ProgressCallbackCR onProgress)
 
ProgressCallbackCR GetDownloadProgressCallback () const
 
void SetUploadProgressCallback (ProgressCallbackCR onProgress)
 
ProgressCallbackCR GetUploadProgressCallback () const
 
BEHTTP_EXPORT folly::Future
< Response
Perform ()
 
Tasks::AsyncTaskPtr< ResponsePerformAsync ()
 

Member Typedef Documentation

typedef std::function<void (double bytesTransfered, double bytesTotal)> ProgressCallback

Member Enumeration Documentation

enum RetryOption
strong
Enumerator
DontRetry 
ResetTransfer 
ResumeTransfer 

Constructor & Destructor Documentation

BEHTTP_EXPORT Request ( Utf8StringCR  url,
Utf8StringCR  method = "GET" 
)

Member Function Documentation

BEHTTP_EXPORT Utf8String EscapeUnsafeSymbolsInUrl ( Utf8StringCR  url)

Referenced by SetProxy().

Tasks::ICancellationTokenPtr GetCancellationToken ( ) const
unsigned GetConnectionTimeoutSeconds ( ) const
ProgressCallbackCR GetDownloadProgressCallback ( ) const
bool GetFollowRedirects ( ) const
HttpRequestHeadersR GetHeaders ( )
HttpRequestHeadersCR GetHeaders ( ) const
unsigned GetMaxRetries ( ) const
Utf8StringCR GetMethod ( ) const
Utf8StringCR GetProxy ( ) const
HttpBodyPtr GetRequestBody ( ) const
HttpBodyPtr GetResponseBody ( ) const
RetryOption const& GetRetryOption ( ) const
unsigned GetTransferTimeoutSeconds ( ) const
ProgressCallbackCR GetUploadProgressCallback ( ) const
Utf8StringCR GetUrl ( ) const
bool GetUseNewConnection ( ) const
bool GetValidateCertificate ( ) const
BEHTTP_EXPORT folly::Future<Response> Perform ( )
Tasks::AsyncTaskPtr<Response> PerformAsync ( )
void SetCancellationToken ( Tasks::ICancellationTokenPtr  token)
void SetConnectionTimeoutSeconds ( unsigned  connectionTimeout)
void SetDownloadProgressCallback ( ProgressCallbackCR  onProgress)
void SetFollowRedirects ( bool  follow)

Enable or disable following redirects. Default is true.

void SetProxy ( Utf8StringCR  proxyUrl)
void SetRequestBody ( HttpBodyPtr  body)
void SetResponseBody ( HttpBodyPtr  body)
void SetRetryOptions ( RetryOption  option,
unsigned  maximumRetries = 1 
)
void SetTimeoutSeconds ( unsigned  connectionAndTransferTimeout)

Sets connection and transfer timeouts with one value. Default - 60 seconds.

void SetTransferTimeoutSeconds ( unsigned  transferTimeout)
void SetUploadProgressCallback ( ProgressCallbackCR  onProgress)
void SetUseNewConnection ( bool  useNewConnection)
void SetValidateCertificate ( bool  validate)

Enable or disable server certificate and hostname validation.


The documentation for this struct was generated from the following file:

Copyright © 2017 Bentley Systems, Incorporated. All rights reserved.