Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add missing http verbs in http spec #3207

Merged
merged 1 commit into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 31 additions & 37 deletions src/aws-cpp-sdk-core/include/aws/core/http/HttpTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,43 +20,37 @@ namespace Aws
/**
* Models Http methods.
*/
enum class HttpMethod
{
HTTP_GET,
HTTP_POST,
HTTP_DELETE,
HTTP_PUT,
HTTP_HEAD,
HTTP_PATCH
};

/**
* Possible default http factory vended http client implementations.
*/
enum class TransferLibType
{
DEFAULT_CLIENT = 0,
CURL_CLIENT,
WIN_INET_CLIENT,
WIN_HTTP_CLIENT
};

/**
* Configuration for a HTTP client, currently used only by libCurl
*/
enum class TransferLibPerformanceMode
{
LOW_LATENCY = 0, // run http client for a lower latency, at the expense of CPU
REGULAR
};

namespace HttpMethodMapper
{
/**
* Gets the string value of an httpMethod.
*/
AWS_CORE_API const char* GetNameForHttpMethod(HttpMethod httpMethod);
} // namespace HttpMethodMapper
enum class HttpMethod {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good. Food for thought: Maybe in future, we can introduce a wrapped enum macro which can not only generate the enum class but also have a toString method for the concerned enum class. Then we can get the enum string and do contextual parsing as needed.

HTTP_GET,
HTTP_POST,
HTTP_DELETE,
HTTP_PUT,
HTTP_HEAD,
HTTP_PATCH,
HTTP_CONNECT,
HTTP_OPTIONS,
HTTP_TRACE,
};

/**
* Possible default http factory vended http client implementations.
*/
enum class TransferLibType { DEFAULT_CLIENT = 0, CURL_CLIENT, WIN_INET_CLIENT, WIN_HTTP_CLIENT };

/**
* Configuration for a HTTP client, currently used only by libCurl
*/
enum class TransferLibPerformanceMode {
LOW_LATENCY = 0, // run http client for a lower latency, at the expense of CPU
REGULAR
};

namespace HttpMethodMapper {
/**
* Gets the string value of an httpMethod.
*/
AWS_CORE_API const char* GetNameForHttpMethod(HttpMethod httpMethod);
} // namespace HttpMethodMapper

typedef std::pair<Aws::String, Aws::String> HeaderValuePair;
typedef Aws::Map<Aws::String, Aws::String> HeaderValueCollection;
Expand Down
10 changes: 8 additions & 2 deletions src/aws-cpp-sdk-core/source/http/HttpTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,15 @@ const char* GetNameForHttpMethod(HttpMethod httpMethod)
return "HEAD";
case HttpMethod::HTTP_PATCH:
return "PATCH";
case HttpMethod::HTTP_CONNECT:
return "CONNECT";
case HttpMethod::HTTP_OPTIONS:
return "OPTIONS";
case HttpMethod::HTTP_TRACE:
return "TRACE";
default:
assert(0);
return "GET";
assert(0);
return "GET";
}
}

Expand Down